From f54626df0b8aed0c3374cb6caafdb49aa4198006 Mon Sep 17 00:00:00 2001 From: Fluf <36822577+flufmonster@users.noreply.github.com> Date: Sat, 9 Jun 2018 18:35:14 -0400 Subject: [PATCH] Add config path as an optional flag when changing pass via CLI (#4184) --- cmd/admin.go | 9 +++++++++ docs/content/doc/usage/command-line.md | 1 + 2 files changed, 10 insertions(+) diff --git a/cmd/admin.go b/cmd/admin.go index 6c79141ea..4fb0810c6 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -73,6 +73,11 @@ var ( Value: "", Usage: "New password to set for user", }, + cli.StringFlag{ + Name: "config, c", + Value: "custom/conf/app.ini", + Usage: "Custom configuration file path", + }, }, } @@ -123,6 +128,10 @@ func runChangePassword(c *cli.Context) error { return err } + if c.IsSet("config") { + setting.CustomConf = c.String("config") + } + if err := initDB(); err != nil { return err } diff --git a/docs/content/doc/usage/command-line.md b/docs/content/doc/usage/command-line.md index 9c16d4904..a7a10b4e4 100644 --- a/docs/content/doc/usage/command-line.md +++ b/docs/content/doc/usage/command-line.md @@ -62,6 +62,7 @@ Admin operations: - Options: - `--username value`, `-u value`: Username. Required. - `--password value`, `-p value`: New password. Required. + - `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini). - Examples: - `gitea admin change-password --username myname --password asecurepassword` - `regenerate`