Stanislav N. aka pztrn
9e5f98a413
All checks were successful
continuous-integration/drone/push Build is passing
34 lines
582 B
Go
34 lines
582 B
Go
package configuration
|
|
|
|
import (
|
|
"github.com/rs/zerolog"
|
|
"go.dev.pztrn.name/giredore/internal/logger"
|
|
)
|
|
|
|
var (
|
|
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:exhaustruct
|
|
envCfg = &envConfig{}
|
|
envCfg.Initialize()
|
|
|
|
// nolint:exhaustruct
|
|
Cfg = &fileConfig{}
|
|
Cfg.Initialize()
|
|
|
|
Cfg.HTTP.Listen = envCfg.HTTP.Listen
|
|
Cfg.HTTP.WaitForSeconds = envCfg.HTTP.WaitForSeconds
|
|
}
|
|
|
|
func Shutdown() {
|
|
Cfg.Save()
|
|
}
|