1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2025-04-17 12:41:51 +00:00

Add cookie auth key flag and environ variable

This commit is contained in:
nyanloutre 2020-04-08 23:53:28 +02:00
parent 827cc380d0
commit a2eb24c8e4

View file

@ -45,6 +45,7 @@ type mainConfig struct {
var (
cfg = struct {
ConfigFile string `flag:"config,c" default:"config.yaml" env:"CONFIG" description:"Location of the configuration file"`
AuthKey string `flag:"authkey" env:"COOKIE_AUTHENTICATION_KEY" description:"Cookie authentication key"`
LogLevel string `flag:"log-level" default:"info" description:"Level of logs to display (debug, info, warn, error)"`
TemplateDir string `flag:"frontend-dir" default:"./frontend/" env:"FRONTEND_DIR" description:"Location of the directory containing the web assets"`
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
@ -91,6 +92,10 @@ func loadConfiguration() ([]byte, error) {
return nil, errors.Wrap(err, "Unable to load configuration file")
}
if cfg.AuthKey != "" {
mainCfg.Cookie.AuthKey = cfg.AuthKey
}
return yamlSource, nil
}