giredore/internal/configuration/exported.go
Stanislav N. aka pztrn 6ce7747dd5
Working with packages and allowed IPs.
giredorectl now able to interact with giredored about:

* Setting package data. There is no such thing as "create" or "update",
just set.

* Deleting package data.

* Setting allowed IP addresses. This is the only authorization method
ATM, more may come in future.
2019-10-07 18:21:26 +05:00

37 lines
632 B
Go

package configuration
import (
// local
"sources.dev.pztrn.name/pztrn/giredore/internal/logger"
// other
"github.com/rs/zerolog"
)
var (
log zerolog.Logger
loggerInitialized bool
envCfg *envConfig
Cfg *fileConfig
)
func Initialize() {
log = logger.Logger.With().Str("type", "internal").Str("package", "configuration").Logger()
loggerInitialized = true
log.Info().Msg("Initializing...")
envCfg = &envConfig{}
envCfg.Initialize()
Cfg = &fileConfig{}
Cfg.Initialize()
Cfg.HTTP.Listen = envCfg.HTTP.Listen
Cfg.HTTP.WaitForSeconds = envCfg.HTTP.WaitForSeconds
}
func Shutdown() {
Cfg.Save()
}