Browse Source

Add config path as an optional flag when changing pass via CLI (#4184)

for-closed-social
Fluf 6 years ago
committed by techknowlogick
parent
commit
f54626df0b
2 changed files with 10 additions and 0 deletions
  1. +9
    -0
      cmd/admin.go
  2. +1
    -0
      docs/content/doc/usage/command-line.md

+ 9
- 0
cmd/admin.go View File

@ -73,6 +73,11 @@ var (
Value: "", Value: "",
Usage: "New password to set for user", 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 return err
} }
if c.IsSet("config") {
setting.CustomConf = c.String("config")
}
if err := initDB(); err != nil { if err := initDB(); err != nil {
return err return err
} }

+ 1
- 0
docs/content/doc/usage/command-line.md View File

@ -62,6 +62,7 @@ Admin operations:
- Options: - Options:
- `--username value`, `-u value`: Username. Required. - `--username value`, `-u value`: Username. Required.
- `--password value`, `-p value`: New password. Required. - `--password value`, `-p value`: New password. Required.
- `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini).
- Examples: - Examples:
- `gitea admin change-password --username myname --password asecurepassword` - `gitea admin change-password --username myname --password asecurepassword`
- `regenerate` - `regenerate`

Loading…
Cancel
Save