From 5e40728ec361ed8358ffb6a504b09b39c5e7a651 Mon Sep 17 00:00:00 2001 From: Paul TREHIOU Date: Thu, 9 Apr 2020 16:08:14 +0200 Subject: [PATCH] Add cookie auth key environment variable (#59) --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 6c19901..bf80f3d 100644 --- a/main.go +++ b/main.go @@ -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 }