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

Add cookie auth key environment variable (#59)

This commit is contained in:
Paul TREHIOU 2020-04-09 16:08:14 +02:00 committed by GitHub
parent 827cc380d0
commit 5e40728ec3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
}