From a4b089a6dbf9821ecede428cd7d13e69c8b85231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Tue, 30 Jan 2024 18:14:50 +0900 Subject: [PATCH] feat: allow to configure if home directory is automatically created from cli (#2963) --- cmd/config.go | 1 + cmd/config_init.go | 11 ++++++----- cmd/config_set.go | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index ed3cc772..5c7efbba 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -31,6 +31,7 @@ func addConfigFlags(flags *pflag.FlagSet) { addServerFlags(flags) addUserFlags(flags) flags.BoolP("signup", "s", false, "allow users to signup") + flags.Bool("create-user-dir", false, "generate user's home directory automatically") flags.String("shell", "", "shell command to which other commands should be appended") flags.String("auth.method", string(auth.MethodJSONAuth), "authentication type") diff --git a/cmd/config_init.go b/cmd/config_init.go index 7d183368..611e6c50 100644 --- a/cmd/config_init.go +++ b/cmd/config_init.go @@ -29,11 +29,12 @@ override the options.`, authMethod, auther := getAuthentication(flags) s := &settings.Settings{ - Key: generateKey(), - Signup: mustGetBool(flags, "signup"), - Shell: convertCmdStrToCmdArray(mustGetString(flags, "shell")), - AuthMethod: authMethod, - Defaults: defaults, + Key: generateKey(), + Signup: mustGetBool(flags, "signup"), + CreateUserDir: mustGetBool(flags, "create-user-dir"), + Shell: convertCmdStrToCmdArray(mustGetString(flags, "shell")), + AuthMethod: authMethod, + Defaults: defaults, Branding: settings.Branding{ Name: mustGetString(flags, "branding.name"), DisableExternal: mustGetBool(flags, "branding.disableExternal"), diff --git a/cmd/config_set.go b/cmd/config_set.go index ba800adb..9dbea9dc 100644 --- a/cmd/config_set.go +++ b/cmd/config_set.go @@ -49,6 +49,8 @@ you want to change. Other options will remain unchanged.`, hasAuth = true case "shell": set.Shell = convertCmdStrToCmdArray(mustGetString(flags, flag.Name)) + case "create-user-dir": + set.CreateUserDir = mustGetBool(flags, flag.Name) case "branding.name": set.Branding.Name = mustGetString(flags, flag.Name) case "branding.color":