mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:38:50 +02:00
chore(config): make initialization timeout configurable via environment variable
Replaced hardcoded 10-second initialization timeout with a configurable `INIT_TIMEOUT` environment variable. The new default is 1 minute, allowing operators to adjust startup behavior based on their infrastructure requirements.
This commit is contained in:
@@ -38,7 +38,7 @@ func main() {
|
|||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
return
|
return
|
||||||
case <-time.After(time.Second * 10):
|
case <-time.After(common.InitTimeout):
|
||||||
log.Fatal().Msgf("timeout waiting for initialization to complete, exiting...")
|
log.Fatal().Msgf("timeout waiting for initialization to complete, exiting...")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ var (
|
|||||||
IsDebug = env.GetEnvBool("DEBUG", IsTest)
|
IsDebug = env.GetEnvBool("DEBUG", IsTest)
|
||||||
IsTrace = env.GetEnvBool("TRACE", false) && IsDebug
|
IsTrace = env.GetEnvBool("TRACE", false) && IsDebug
|
||||||
|
|
||||||
|
InitTimeout = env.GetEnvDuation("INIT_TIMEOUT", 1*time.Minute)
|
||||||
|
|
||||||
ShortLinkPrefix = env.GetEnvString("SHORTLINK_PREFIX", "go")
|
ShortLinkPrefix = env.GetEnvString("SHORTLINK_PREFIX", "go")
|
||||||
|
|
||||||
ProxyHTTPAddr,
|
ProxyHTTPAddr,
|
||||||
|
|||||||
Reference in New Issue
Block a user