package roomescape.common.config import com.github.f4b6a3.tsid.TsidFactory import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @Configuration class TsidConfig { @Value("\${POD_NAME:app-0}") private lateinit var podName: String @Bean fun tsidFactory(): TsidFactory = TsidFactory(podName.substringAfterLast("-").toInt()) } fun TsidFactory.next(): Long = this.create().toLong()