aboutsummaryrefslogtreecommitdiff
path: root/cmd/serve.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/serve.go')
-rw-r--r--cmd/serve.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 1f5d944d..25f7dd91 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -27,7 +27,9 @@ var CmdServ = cli.Command{
Usage: "This command should only be called by SSH shell",
Description: `Serv provide access auth for repositories`,
Action: runServ,
- Flags: []cli.Flag{},
+ Flags: []cli.Flag{
+ cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ },
}
func setup(logPath string) {
@@ -83,9 +85,15 @@ func In(b string, sl map[string]models.AccessType) bool {
}
func runServ(k *cli.Context) {
+ if k.IsSet("config") {
+ setting.CustomConf = k.String("config")
+ }
setup("serv.log")
- keys := strings.Split(os.Args[2], "-")
+ if len(k.Args()) < 1 {
+ log.GitLogger.Fatal(2, "Not enough arguments")
+ }
+ keys := strings.Split(k.Args()[0], "-")
if len(keys) != 2 {
println("Gogs: auth file format error")
log.GitLogger.Fatal(2, "Invalid auth file format: %s", os.Args[2])