mirror of
https://github.com/Luzifer/nginx-sso.git
synced 2024-12-20 12:51:17 +00:00
Add cookie auth key environment variable (#59)
This commit is contained in:
parent
827cc380d0
commit
5e40728ec3
1 changed files with 5 additions and 0 deletions
5
main.go
5
main.go
|
@ -45,6 +45,7 @@ type mainConfig struct {
|
||||||
var (
|
var (
|
||||||
cfg = struct {
|
cfg = struct {
|
||||||
ConfigFile string `flag:"config,c" default:"config.yaml" env:"CONFIG" description:"Location of the configuration file"`
|
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)"`
|
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"`
|
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"`
|
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")
|
return nil, errors.Wrap(err, "Unable to load configuration file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.AuthKey != "" {
|
||||||
|
mainCfg.Cookie.AuthKey = cfg.AuthKey
|
||||||
|
}
|
||||||
|
|
||||||
return yamlSource, nil
|
return yamlSource, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue