diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-22 09:05:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 09:05:26 +0800 |
commit | 648d9e253c1924b832248f26fee42b2fb64dc3bc (patch) | |
tree | 51649fad974cd7284a47d30e412c90e7ab72cd2c /internal/cmd/import.go | |
parent | 5b14cc6f0b7b661beb2640a94bd15660cdb48587 (diff) |
conf: overhaul server settings (#5928)
* conf: rename package
* Requires Go 1.12
* Fix lint
* Fix lint
* Overhaul
* db: fix tests
* Save my work
* Fix tests
* Server.UnixSocketPermission
* Server.LocalRootURL
* SSH settings
* Server.OfflineMode
* Save my work
* App.Version
* Remove [server] STATIC_ROOT_PATH
* Server.LandingURL
Diffstat (limited to 'internal/cmd/import.go')
-rw-r--r-- | internal/cmd/import.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/internal/cmd/import.go b/internal/cmd/import.go index 0f3a2d44..e9795693 100644 --- a/internal/cmd/import.go +++ b/internal/cmd/import.go @@ -7,16 +7,16 @@ package cmd import ( "bufio" "bytes" - "errors" "fmt" "os" "path/filepath" "time" + "github.com/pkg/errors" "github.com/unknwon/com" "github.com/urfave/cli" - "gogs.io/gogs/internal/setting" + "gogs.io/gogs/internal/conf" ) var ( @@ -54,12 +54,11 @@ func runImportLocale(c *cli.Context) error { return fmt.Errorf("target directory %q does not exist or is not a directory", c.String("target")) } - if c.IsSet("config") { - setting.CustomConf = c.String("config") + err := conf.Init(c.String("config")) + if err != nil { + return errors.Wrap(err, "init configuration") } - setting.Init() - now := time.Now() line := make([]byte, 0, 100) @@ -67,7 +66,7 @@ func runImportLocale(c *cli.Context) error { escapedQuotes := []byte(`\"`) regularQuotes := []byte(`"`) // Cut out en-US. - for _, lang := range setting.Langs[1:] { + for _, lang := range conf.Langs[1:] { name := fmt.Sprintf("locale_%s.ini", lang) source := filepath.Join(c.String("source"), name) target := filepath.Join(c.String("target"), name) |