diff options
author | zeripath <art27@cantab.net> | 2019-04-29 19:08:21 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-04-29 14:08:21 -0400 |
commit | 8d0d7bc28d517acc9ca98f0468d7ff2a4fdaf139 (patch) | |
tree | 0a8817abd2512ca2ebccfd4e5dc08814933aad2b /cmd | |
parent | ccf4783980effa871abaecd70d0f983c5062a187 (diff) | |
download | gitea-8d0d7bc28d517acc9ca98f0468d7ff2a4fdaf139.tar.gz gitea-8d0d7bc28d517acc9ca98f0468d7ff2a4fdaf139.zip |
Make CustomPath, CustomConf and AppWorkPath configurable at build (#6631)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/admin.go | 76 | ||||
-rw-r--r-- | cmd/dump.go | 8 | ||||
-rw-r--r-- | cmd/hook.go | 26 | ||||
-rw-r--r-- | cmd/keys.go | 10 | ||||
-rw-r--r-- | cmd/migrate.go | 11 | ||||
-rw-r--r-- | cmd/serv.go | 8 | ||||
-rw-r--r-- | cmd/web.go | 9 |
7 files changed, 0 insertions, 148 deletions
diff --git a/cmd/admin.go b/cmd/admin.go index b46eb2871e..be21ec0f36 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -60,11 +60,6 @@ var ( Name: "admin", Usage: "User is an admin", }, - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, cli.BoolFlag{ Name: "random-password", Usage: "Generate a random password for the user", @@ -96,11 +91,6 @@ 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,26 +113,12 @@ var ( Name: "hooks", Usage: "Regenerate git-hooks", Action: runRegenerateHooks, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - }, } microcmdRegenKeys = cli.Command{ Name: "keys", Usage: "Regenerate authorized_keys file", Action: runRegenerateKeys, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - }, } subcmdAuth = cli.Command{ @@ -160,13 +136,6 @@ var ( Name: "list", Usage: "List auth sources", Action: runListAuth, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - }, } idFlag = cli.Int64Flag{ @@ -178,23 +147,10 @@ var ( Name: "delete", Usage: "Delete specific auth source", Action: runDeleteAuth, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - idFlag, - }, } oauthCLIFlags = []cli.Flag{ cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - cli.StringFlag{ Name: "name", Value: "", Usage: "Application Name", @@ -266,10 +222,6 @@ func runChangePassword(c *cli.Context) error { return err } - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -331,10 +283,6 @@ func runCreateUser(c *cli.Context) error { return errors.New("must set either password or random-password flag") } - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -430,10 +378,6 @@ func getReleaseCount(id int64) (int64, error) { } func runRegenerateHooks(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -441,10 +385,6 @@ func runRegenerateHooks(c *cli.Context) error { } func runRegenerateKeys(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -473,10 +413,6 @@ func parseOAuth2Config(c *cli.Context) *models.OAuth2Config { } func runAddOauth(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -490,10 +426,6 @@ func runAddOauth(c *cli.Context) error { } func runUpdateOauth(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if !c.IsSet("id") { return fmt.Errorf("--id flag is missing") } @@ -561,10 +493,6 @@ func runUpdateOauth(c *cli.Context) error { } func runListAuth(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if err := initDB(); err != nil { return err } @@ -587,10 +515,6 @@ func runListAuth(c *cli.Context) error { } func runDeleteAuth(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if !c.IsSet("id") { return fmt.Errorf("--id flag is missing") } diff --git a/cmd/dump.go b/cmd/dump.go index 98e930f2fb..a9e83f36d9 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -31,11 +31,6 @@ It can be used for backup and capture Gitea server image to send to maintainer`, Action: runDump, Flags: []cli.Flag{ cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - cli.StringFlag{ Name: "file, f", Value: fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix()), Usage: "Name of the dump file which will be created.", @@ -61,9 +56,6 @@ It can be used for backup and capture Gitea server image to send to maintainer`, } func runDump(ctx *cli.Context) error { - if ctx.IsSet("config") { - setting.CustomConf = ctx.String("config") - } setting.NewContext() setting.NewServices() // cannot access session settings otherwise models.LoadConfigs() diff --git a/cmd/hook.go b/cmd/hook.go index 88e61c61d1..46f97d5542 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -16,7 +16,6 @@ import ( "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/private" - "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "github.com/urfave/cli" @@ -28,13 +27,6 @@ var ( Name: "hook", Usage: "Delegate commands to corresponding Git hooks", Description: "This should only be called by Git", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - }, Subcommands: []cli.Command{ subcmdHookPreReceive, subcmdHookUpdate, @@ -67,12 +59,6 @@ func runHookPreReceive(c *cli.Context) error { return nil } - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } else if c.GlobalIsSet("config") { - setting.CustomConf = c.GlobalString("config") - } - setup("hooks/pre-receive.log") // the environment setted on serv command @@ -143,12 +129,6 @@ func runHookUpdate(c *cli.Context) error { return nil } - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } else if c.GlobalIsSet("config") { - setting.CustomConf = c.GlobalString("config") - } - setup("hooks/update.log") return nil @@ -159,12 +139,6 @@ func runHookPostReceive(c *cli.Context) error { return nil } - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } else if c.GlobalIsSet("config") { - setting.CustomConf = c.GlobalString("config") - } - setup("hooks/post-receive.log") // the environment setted on serv command diff --git a/cmd/keys.go b/cmd/keys.go index 66565cc563..39153c7cb7 100644 --- a/cmd/keys.go +++ b/cmd/keys.go @@ -10,7 +10,6 @@ import ( "strings" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/modules/setting" "github.com/urfave/cli" ) @@ -41,19 +40,10 @@ var CmdKeys = cli.Command{ Value: "", Usage: "Base64 encoded content of the SSH key provided to the SSH Server (requires type to be provided too)", }, - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, }, } func runKeys(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } - if !c.IsSet("username") { return errors.New("No username provided") } diff --git a/cmd/migrate.go b/cmd/migrate.go index 3e6bf907a4..dde50a455f 100644 --- a/cmd/migrate.go +++ b/cmd/migrate.go @@ -19,20 +19,9 @@ var CmdMigrate = cli.Command{ Usage: "Migrate the database", Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.", Action: runMigrate, - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - }, } func runMigrate(ctx *cli.Context) error { - if ctx.IsSet("config") { - setting.CustomConf = ctx.String("config") - } - if err := initDB(); err != nil { return err } diff --git a/cmd/serv.go b/cmd/serv.go index ebd71ad3c7..a30e02e7a2 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -39,11 +39,6 @@ var CmdServ = cli.Command{ Description: `Serv provide access auth for repositories`, Action: runServ, Flags: []cli.Flag{ - cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, cli.BoolFlag{ Name: "enable-pprof", }, @@ -109,9 +104,6 @@ func fail(userMessage, logMessage string, args ...interface{}) { } func runServ(c *cli.Context) error { - if c.IsSet("config") { - setting.CustomConf = c.String("config") - } setup("serv.log") if setting.SSH.Disabled { diff --git a/cmd/web.go b/cmd/web.go index 4641645ee4..6da6ec942e 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -41,11 +41,6 @@ and it takes care of all the other things for you`, Usage: "Temporary port number to prevent conflict", }, cli.StringFlag{ - Name: "config, c", - Value: "custom/conf/app.ini", - Usage: "Custom configuration file path", - }, - cli.StringFlag{ Name: "pid, P", Value: "/var/run/gitea.pid", Usage: "Custom pid file path", @@ -110,10 +105,6 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) { } func runWeb(ctx *cli.Context) error { - if ctx.IsSet("config") { - setting.CustomConf = ctx.String("config") - } - if ctx.IsSet("pid") { setting.CustomPID = ctx.String("pid") } |