Skip to content

Commit f54626d

Browse files
Fluftechknowlogick
Fluf
authored andcommitted
Add config path as an optional flag when changing pass via CLI (#4184)
1 parent 9033eae commit f54626d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cmd/admin.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ var (
7373
Value: "",
7474
Usage: "New password to set for user",
7575
},
76+
cli.StringFlag{
77+
Name: "config, c",
78+
Value: "custom/conf/app.ini",
79+
Usage: "Custom configuration file path",
80+
},
7681
},
7782
}
7883

@@ -123,6 +128,10 @@ func runChangePassword(c *cli.Context) error {
123128
return err
124129
}
125130

131+
if c.IsSet("config") {
132+
setting.CustomConf = c.String("config")
133+
}
134+
126135
if err := initDB(); err != nil {
127136
return err
128137
}

docs/content/doc/usage/command-line.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Admin operations:
6262
- Options:
6363
- `--username value`, `-u value`: Username. Required.
6464
- `--password value`, `-p value`: New password. Required.
65+
- `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini).
6566
- Examples:
6667
- `gitea admin change-password --username myname --password asecurepassword`
6768
- `regenerate`

0 commit comments

Comments
 (0)