giredore/internal/configuration/exported.go

34 lines
592 B
Go
Raw Normal View History

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