summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorThomas Boerger <thomas@webhippie.de>2016-12-22 19:12:23 +0100
committerGitHub <noreply@github.com>2016-12-22 19:12:23 +0100
commitb33078fa33441c33c5d018b1b9a248c646549842 (patch)
tree0f890f88987764c1409c6c9d90edd8e727f3219e /cmd
parentc21e2c4151b5bc13e54de902f59e7b4c46b47540 (diff)
downloadgitea-b33078fa33441c33c5d018b1b9a248c646549842.tar.gz
gitea-b33078fa33441c33c5d018b1b9a248c646549842.zip
Bindata is optional and over-writable on restart (#354)
* Moved conf assets into options folder * Dropped old bindata * Started to integrate options bindata and accessors * Do not enforce a builtin app.ini * Replaced bindata calls with options * Dropped bindata task from makefile, it's the generate task now * Always embedd app.ini to provide sane config defaults * Use sane defaults for the configuration * Defined default value for SSH_KEYGEN_PATH * Dropped "NEVER EVER MODIFY THIS FILE" header from app.ini * Fixed new paths in latest test additions * Drop bindata with make clean task * Set more proper default values
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go27
1 files changed, 17 insertions, 10 deletions
diff --git a/cmd/web.go b/cmd/web.go
index db6e2305cd..9776fdc11a 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -16,9 +16,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
- "code.gitea.io/gitea/modules/bindata"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/options"
"code.gitea.io/gitea/modules/public"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
@@ -99,22 +99,29 @@ func newMacaron() *macaron.Macaron {
m.Use(templates.Renderer())
models.InitMailRender(templates.Mailer())
- localeNames, err := bindata.AssetDir("conf/locale")
+ localeNames, err := options.Dir("locale")
+
if err != nil {
log.Fatal(4, "Fail to list locale files: %v", err)
}
+
localFiles := make(map[string][]byte)
+
for _, name := range localeNames {
- localFiles[name] = bindata.MustAsset("conf/locale/" + name)
+ localFiles[name], err = options.Locale(name)
+
+ if err != nil {
+ log.Fatal(4, "Failed to load %s locale file. %v", name, err)
+ }
}
+
m.Use(i18n.I18n(i18n.Options{
- SubURL: setting.AppSubURL,
- Files: localFiles,
- CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
- Langs: setting.Langs,
- Names: setting.Names,
- DefaultLang: "en-US",
- Redirect: true,
+ SubURL: setting.AppSubURL,
+ Files: localFiles,
+ Langs: setting.Langs,
+ Names: setting.Names,
+ DefaultLang: "en-US",
+ Redirect: true,
}))
m.Use(cache.Cacher(cache.Options{
Adapter: setting.CacheAdapter,