Commit d6e62a7b authored by Sietse Ringers's avatar Sietse Ringers
Browse files

fix: bug in server configuration defaults when enabling production mode through config file

In production nmode the defaults of several server configuration options should change to be more restrictive. When enabling production mode in a configuration file this would not happen.
parent da76143f
...@@ -190,6 +190,9 @@ func configure(cmd *cobra.Command) error { ...@@ -190,6 +190,9 @@ func configure(cmd *cobra.Command) error {
mode := "development" mode := "development"
if viper.GetBool("production") { if viper.GetBool("production") {
mode = "production" mode = "production"
viper.SetDefault("no-auth", false)
viper.SetDefault("no-email", false)
viper.SetDefault("url", "")
} }
logger.WithFields(logrus.Fields{ logger.WithFields(logrus.Fields{
"version": irma.Version, "version": irma.Version,
...@@ -319,7 +322,7 @@ func handlePermission(typ string) []string { ...@@ -319,7 +322,7 @@ func handlePermission(typ string) []string {
func productionMode() bool { func productionMode() bool {
for i, arg := range os.Args { for i, arg := range os.Args {
if arg == "--production" { if arg == "--production" {
if len(os.Args) == i+1 || strings.HasPrefix(os.Args[i+1], "--") { if len(os.Args) == i+1 || strings.HasPrefix(os.Args[i+1], "-") {
return true return true
} }
if checkConfVal(os.Args[i+1]) { if checkConfVal(os.Args[i+1]) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment