2019-10-05 21:53:22 +05:00
|
|
|
package configuration
|
|
|
|
|
|
|
|
import (
|
|
|
|
// local
|
|
|
|
"sources.dev.pztrn.name/pztrn/giredore/internal/logger"
|
|
|
|
|
|
|
|
// other
|
|
|
|
"github.com/rs/zerolog"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2019-10-07 21:51:45 +05:00
|
|
|
log zerolog.Logger
|
2019-10-05 21:53:22 +05:00
|
|
|
|
2019-10-07 18:21:26 +05:00
|
|
|
envCfg *envConfig
|
|
|
|
Cfg *fileConfig
|
2019-10-05 21:53:22 +05:00
|
|
|
)
|
|
|
|
|
|
|
|
func Initialize() {
|
|
|
|
log = logger.Logger.With().Str("type", "internal").Str("package", "configuration").Logger()
|
|
|
|
log.Info().Msg("Initializing...")
|
|
|
|
|
2019-10-07 18:21:26 +05:00
|
|
|
envCfg = &envConfig{}
|
|
|
|
envCfg.Initialize()
|
|
|
|
|
|
|
|
Cfg = &fileConfig{}
|
2019-10-05 21:53:22 +05:00
|
|
|
Cfg.Initialize()
|
2019-10-07 18:21:26 +05:00
|
|
|
|
|
|
|
Cfg.HTTP.Listen = envCfg.HTTP.Listen
|
|
|
|
Cfg.HTTP.WaitForSeconds = envCfg.HTTP.WaitForSeconds
|
|
|
|
}
|
|
|
|
|
|
|
|
func Shutdown() {
|
|
|
|
Cfg.Save()
|
2019-10-05 21:53:22 +05:00
|
|
|
}
|