Browse Source

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
Thomas Boerger 3 years ago
parent
commit
b33078fa33
100 changed files with 292 additions and 5404 deletions
  1. 1 0
      .gitignore
  2. 3 19
      Makefile
  3. 17 10
      cmd/web.go
  4. 0 3
      conf/README.md
  5. 0 3
      conf/app.ini
  6. 16 5
      models/repo.go
  7. 1 1
      modules/base/tool_test.go
  8. 0 5353
      modules/bindata/bindata.go
  9. 94 0
      modules/options/dynamic.go
  10. 51 0
      modules/options/options.go
  11. 84 0
      modules/options/static.go
  12. 25 10
      modules/setting/setting.go
  13. 0 0
      options/gitignore/Actionscript
  14. 0 0
      options/gitignore/Ada
  15. 0 0
      options/gitignore/Agda
  16. 0 0
      options/gitignore/Android
  17. 0 0
      options/gitignore/Anjuta
  18. 0 0
      options/gitignore/AppEngine
  19. 0 0
      options/gitignore/AppceleratorTitanium
  20. 0 0
      options/gitignore/ArchLinuxPackages
  21. 0 0
      options/gitignore/Archives
  22. 0 0
      options/gitignore/Autotools
  23. 0 0
      options/gitignore/BricxCC
  24. 0 0
      options/gitignore/C
  25. 0 0
      options/gitignore/C Sharp
  26. 0 0
      options/gitignore/C++
  27. 0 0
      options/gitignore/CFWheels
  28. 0 0
      options/gitignore/CMake
  29. 0 0
      options/gitignore/CUDA
  30. 0 0
      options/gitignore/CVS
  31. 0 0
      options/gitignore/CakePHP
  32. 0 0
      options/gitignore/ChefCookbook
  33. 0 0
      options/gitignore/Cloud9
  34. 0 0
      options/gitignore/CodeIgniter
  35. 0 0
      options/gitignore/CodeKit
  36. 0 0
      options/gitignore/CommonLisp
  37. 0 0
      options/gitignore/Composer
  38. 0 0
      options/gitignore/Concrete5
  39. 0 0
      options/gitignore/Coq
  40. 0 0
      options/gitignore/CraftCMS
  41. 0 0
      options/gitignore/DM
  42. 0 0
      options/gitignore/Dart
  43. 0 0
      options/gitignore/DartEditor
  44. 0 0
      options/gitignore/Delphi
  45. 0 0
      options/gitignore/Dreamweaver
  46. 0 0
      options/gitignore/Drupal
  47. 0 0
      options/gitignore/EPiServer
  48. 0 0
      options/gitignore/Eagle
  49. 0 0
      options/gitignore/Eclipse
  50. 0 0
      options/gitignore/EiffelStudio
  51. 0 0
      options/gitignore/Elisp
  52. 0 0
      options/gitignore/Elixir
  53. 0 0
      options/gitignore/Emacs
  54. 0 0
      options/gitignore/Ensime
  55. 0 0
      options/gitignore/Erlang
  56. 0 0
      options/gitignore/Espresso
  57. 0 0
      options/gitignore/ExpressionEngine
  58. 0 0
      options/gitignore/ExtJs
  59. 0 0
      options/gitignore/Fancy
  60. 0 0
      options/gitignore/Finale
  61. 0 0
      options/gitignore/FlexBuilder
  62. 0 0
      options/gitignore/ForceDotCom
  63. 0 0
      options/gitignore/FuelPHP
  64. 0 0
      options/gitignore/GWT
  65. 0 0
      options/gitignore/Gcov
  66. 0 0
      options/gitignore/GitBook
  67. 0 0
      options/gitignore/Go
  68. 0 0
      options/gitignore/Gradle
  69. 0 0
      options/gitignore/Grails
  70. 0 0
      options/gitignore/Haskell
  71. 0 0
      options/gitignore/IGORPro
  72. 0 0
      options/gitignore/IPythonNotebook
  73. 0 0
      options/gitignore/Idris
  74. 0 0
      options/gitignore/JDeveloper
  75. 0 0
      options/gitignore/Java
  76. 0 0
      options/gitignore/Jboss
  77. 0 0
      options/gitignore/Jekyll
  78. 0 0
      options/gitignore/JetBrains
  79. 0 0
      options/gitignore/Joomla
  80. 0 0
      options/gitignore/KDevelop4
  81. 0 0
      options/gitignore/Kate
  82. 0 0
      options/gitignore/KiCAD
  83. 0 0
      options/gitignore/Kohana
  84. 0 0
      options/gitignore/LabVIEW
  85. 0 0
      options/gitignore/Laravel
  86. 0 0
      options/gitignore/Lazarus
  87. 0 0
      options/gitignore/Leiningen
  88. 0 0
      options/gitignore/LemonStand
  89. 0 0
      options/gitignore/LibreOffice
  90. 0 0
      options/gitignore/Lilypond
  91. 0 0
      options/gitignore/Linux
  92. 0 0
      options/gitignore/Lithium
  93. 0 0
      options/gitignore/Lua
  94. 0 0
      options/gitignore/LyX
  95. 0 0
      options/gitignore/Magento
  96. 0 0
      options/gitignore/Matlab
  97. 0 0
      options/gitignore/Maven
  98. 0 0
      options/gitignore/Mercurial
  99. 0 0
      options/gitignore/Mercury
  100. 0 0
      conf/gitignore/MetaProgrammingSystem

+ 1 - 0
.gitignore

@@ -28,6 +28,7 @@ _testmain.go
28 28
 
29 29
 coverage.out
30 30
 
31
+/modules/options/bindata.go
31 32
 /modules/public/bindata.go
32 33
 /modules/templates/bindata.go
33 34
 

+ 3 - 19
Makefile

@@ -2,10 +2,7 @@ DIST := dist
2 2
 EXECUTABLE := gitea
3 3
 IMPORT := code.gitea.io/gitea
4 4
 
5
-SHA := $(shell git rev-parse --short HEAD)
6
-DATE := $(shell date -u '+%Y-%m-%d %I:%M:%S %Z')
7
-
8
-BINDATA := $(shell find conf | sed 's/ /\\ /g')
5
+BINDATA := modules/{options,public,templates}/bindata.go
9 6
 STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
10 7
 JAVASCRIPTS :=
11 8
 
@@ -33,7 +30,7 @@ all: build
33 30
 .PHONY: clean
34 31
 clean:
35 32
 	go clean -i ./...
36
-	rm -rf $(EXECUTABLE) $(DIST)
33
+	rm -rf $(EXECUTABLE) $(DIST) $(BINDATA)
37 34
 
38 35
 .PHONY: fmt
39 36
 fmt:
@@ -119,19 +116,6 @@ release-copy:
119 116
 release-check:
120 117
 	cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
121 118
 
122
-.PHONY: bindata
123
-bindata: modules/bindata/bindata.go
124
-
125
-.IGNORE: modules/bindata/bindata.go
126
-modules/bindata/bindata.go: $(BINDATA)
127
-	@which go-bindata > /dev/null; if [ $$? -ne 0 ]; then \
128
-		go get -u github.com/jteeuwen/go-bindata/...; \
129
-	fi
130
-	go-bindata -o=$@ -ignore="\\.go|README.md|TRANSLATORS" -pkg=bindata conf/...
131
-	go fmt $@
132
-	sed -i.bak 's/confLocaleLocale_/confLocaleLocale/' $@
133
-	rm $@.bak
134
-
135 119
 .PHONY: javascripts
136 120
 javascripts: public/js/index.js
137 121
 
@@ -147,4 +131,4 @@ public/css/index.css: $(STYLESHEETS)
147 131
 	lessc $< $@
148 132
 
149 133
 .PHONY: assets
150
-assets: bindata javascripts stylesheets
134
+assets: javascripts stylesheets

+ 17 - 10
cmd/web.go

@@ -16,9 +16,9 @@ import (
16 16
 
17 17
 	"code.gitea.io/gitea/models"
18 18
 	"code.gitea.io/gitea/modules/auth"
19
-	"code.gitea.io/gitea/modules/bindata"
20 19
 	"code.gitea.io/gitea/modules/context"
21 20
 	"code.gitea.io/gitea/modules/log"
21
+	"code.gitea.io/gitea/modules/options"
22 22
 	"code.gitea.io/gitea/modules/public"
23 23
 	"code.gitea.io/gitea/modules/setting"
24 24
 	"code.gitea.io/gitea/modules/templates"
@@ -99,22 +99,29 @@ func newMacaron() *macaron.Macaron {
99 99
 	m.Use(templates.Renderer())
100 100
 	models.InitMailRender(templates.Mailer())
101 101
 
102
-	localeNames, err := bindata.AssetDir("conf/locale")
102
+	localeNames, err := options.Dir("locale")
103
+
103 104
 	if err != nil {
104 105
 		log.Fatal(4, "Fail to list locale files: %v", err)
105 106
 	}
107
+
106 108
 	localFiles := make(map[string][]byte)
109
+
107 110
 	for _, name := range localeNames {
108
-		localFiles[name] = bindata.MustAsset("conf/locale/" + name)
111
+		localFiles[name], err = options.Locale(name)
112
+
113
+		if err != nil {
114
+			log.Fatal(4, "Failed to load %s locale file. %v", name, err)
115
+		}
109 116
 	}
117
+
110 118
 	m.Use(i18n.I18n(i18n.Options{
111
-		SubURL:          setting.AppSubURL,
112
-		Files:           localFiles,
113
-		CustomDirectory: path.Join(setting.CustomPath, "conf/locale"),
114
-		Langs:           setting.Langs,
115
-		Names:           setting.Names,
116
-		DefaultLang:     "en-US",
117
-		Redirect:        true,
119
+		SubURL:      setting.AppSubURL,
120
+		Files:       localFiles,
121
+		Langs:       setting.Langs,
122
+		Names:       setting.Names,
123
+		DefaultLang: "en-US",
124
+		Redirect:    true,
118 125
 	}))
119 126
 	m.Use(cache.Cacher(cache.Options{
120 127
 		Adapter:       setting.CacheAdapter,

+ 0 - 3
conf/README.md

@@ -1,3 +0,0 @@
1
-Execute following command in ROOT directory when anything is changed:
2
-
3
-$ make bindata

+ 0 - 3
conf/app.ini

@@ -1,6 +1,3 @@
1
-# NEVER EVER MODIFY THIS FILE
2
-# PLEASE MAKE CHANGES ON CORRESPONDING CUSTOM CONFIG FILE
3
-
4 1
 ; App name that shows on every page title
5 2
 APP_NAME = Gitea: Git with a cup of tea
6 3
 ; Change it if you run locally

+ 16 - 5
models/repo.go

@@ -20,9 +20,9 @@ import (
20 20
 	"time"
21 21
 
22 22
 	"code.gitea.io/git"
23
-	"code.gitea.io/gitea/modules/bindata"
24 23
 	"code.gitea.io/gitea/modules/log"
25 24
 	"code.gitea.io/gitea/modules/markdown"
25
+	"code.gitea.io/gitea/modules/options"
26 26
 	"code.gitea.io/gitea/modules/process"
27 27
 	"code.gitea.io/gitea/modules/setting"
28 28
 	"code.gitea.io/gitea/modules/sync"
@@ -80,11 +80,11 @@ func LoadRepoConfig() {
80 80
 	types := []string{"gitignore", "license", "readme", "label"}
81 81
 	typeFiles := make([][]string, 4)
82 82
 	for i, t := range types {
83
-		files, err := bindata.AssetDir("conf/" + t)
83
+		files, err := options.Dir(t)
84 84
 		if err != nil {
85 85
 			log.Fatal(4, "Fail to get %s files: %v", t, err)
86 86
 		}
87
-		customPath := path.Join(setting.CustomPath, "conf", t)
87
+		customPath := path.Join(setting.CustomPath, "options", t)
88 88
 		if com.IsDir(customPath) {
89 89
 			customFiles, err := com.StatDir(customPath)
90 90
 			if err != nil {
@@ -827,14 +827,25 @@ type CreateRepoOptions struct {
827 827
 }
828 828
 
829 829
 func getRepoInitFile(tp, name string) ([]byte, error) {
830
-	relPath := path.Join("conf", tp, strings.TrimLeft(name, "./"))
830
+	cleanedName := strings.TrimLeft(name, "./")
831
+	relPath := path.Join("options", tp, cleanedName)
831 832
 
832 833
 	// Use custom file when available.
833 834
 	customPath := path.Join(setting.CustomPath, relPath)
834 835
 	if com.IsFile(customPath) {
835 836
 		return ioutil.ReadFile(customPath)
836 837
 	}
837
-	return bindata.Asset(relPath)
838
+
839
+	switch tp {
840
+	case "readme":
841
+		return options.Readme(cleanedName)
842
+	case "gitignore":
843
+		return options.Gitignore(cleanedName)
844
+	case "license":
845
+		return options.License(cleanedName)
846
+	default:
847
+		return []byte{}, fmt.Errorf("Invalid init file type")
848
+	}
838 849
 }
839 850
 
840 851
 func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {

+ 1 - 1
modules/base/tool_test.go

@@ -25,7 +25,7 @@ const (
25 25
 func TestMain(m *testing.M) {
26 26
 	// setup
27 27
 	macaroni18n.I18n(macaroni18n.Options{
28
-		Directory:   "../../conf/locale/",
28
+		Directory:   "../../options/locale/",
29 29
 		DefaultLang: "en-US",
30 30
 		Langs:       []string{"en-US"},
31 31
 		Names:       []string{"english"},

File diff suppressed because it is too large
+ 0 - 5353
modules/bindata/bindata.go


+ 94 - 0
modules/options/dynamic.go

@@ -0,0 +1,94 @@
1
+// +build !bindata
2
+
3
+// Copyright 2016 The Gitea Authors. All rights reserved.
4
+// Use of this source code is governed by a MIT-style
5
+// license that can be found in the LICENSE file.
6
+
7
+package options
8
+
9
+import (
10
+	"fmt"
11
+	"io/ioutil"
12
+	"path"
13
+
14
+	"code.gitea.io/gitea/modules/setting"
15
+	"github.com/Unknwon/com"
16
+)
17
+
18
+var (
19
+	directories = make(directorySet)
20
+)
21
+
22
+// Dir returns all files from static or custom directory.
23
+func Dir(name string) ([]string, error) {
24
+	if directories.Filled(name) {
25
+		return directories.Get(name), nil
26
+	}
27
+
28
+	var (
29
+		result []string
30
+	)
31
+
32
+	customDir := path.Join(setting.CustomPath, "options", name)
33
+
34
+	if com.IsDir(customDir) {
35
+		files, err := com.StatDir(customDir, true)
36
+
37
+		if err != nil {
38
+			return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
39
+		}
40
+
41
+		result = append(result, files...)
42
+	}
43
+
44
+	staticDir := path.Join(setting.StaticRootPath, "options", name)
45
+
46
+	if com.IsDir(staticDir) {
47
+		files, err := com.StatDir(staticDir, true)
48
+
49
+		if err != nil {
50
+			return []string{}, fmt.Errorf("Failed to read static directory. %v", err)
51
+		}
52
+
53
+		result = append(result, files...)
54
+	}
55
+
56
+	return directories.AddAndGet(name, result), nil
57
+}
58
+
59
+// Locale reads the content of a specific locale from static or custom path.
60
+func Locale(name string) ([]byte, error) {
61
+	return fileFromDir(path.Join("locale", name))
62
+}
63
+
64
+// Readme reads the content of a specific readme from static or custom path.
65
+func Readme(name string) ([]byte, error) {
66
+	return fileFromDir(path.Join("readme", name))
67
+}
68
+
69
+// Gitignore reads the content of a specific gitignore from static or custom path.
70
+func Gitignore(name string) ([]byte, error) {
71
+	return fileFromDir(path.Join("gitignore", name))
72
+}
73
+
74
+// License reads the content of a specific license from static or custom path.
75
+func License(name string) ([]byte, error) {
76
+	return fileFromDir(path.Join("license", name))
77
+}
78
+
79
+// fileFromDir is a helper to read files from static or custom path.
80
+func fileFromDir(name string) ([]byte, error) {
81
+	customPath := path.Join(setting.CustomPath, "options", name)
82
+
83
+	if com.IsFile(customPath) {
84
+		return ioutil.ReadFile(customPath)
85
+	}
86
+
87
+	staticPath := path.Join(setting.StaticRootPath, "options", name)
88
+
89
+	if com.IsFile(staticPath) {
90
+		return ioutil.ReadFile(staticPath)
91
+	}
92
+
93
+	return []byte{}, fmt.Errorf("Asset file does not exist: %s", name)
94
+}

+ 51 - 0
modules/options/options.go

@@ -0,0 +1,51 @@
1
+// Copyright 2016 The Gitea Authors. All rights reserved.
2
+// Use of this source code is governed by a MIT-style
3
+// license that can be found in the LICENSE file.
4
+
5
+package options
6
+
7
+//go:generate go-bindata -tags "bindata" -ignore "TRANSLATORS" -pkg "options" -o "bindata.go" ../../options/...
8
+//go:generate go fmt bindata.go
9
+//go:generate sed -i.bak s/..\/..\/options\/// bindata.go
10
+//go:generate rm -f bindata.go.bak
11
+
12
+type directorySet map[string][]string
13
+
14
+func (s directorySet) Add(key string, value []string) {
15
+	_, ok := s[key]
16
+
17
+	if !ok {
18
+		s[key] = make([]string, 0, len(value))
19
+	}
20
+
21
+	s[key] = append(s[key], value...)
22
+}
23
+
24
+func (s directorySet) Get(key string) []string {
25
+	_, ok := s[key]
26
+
27
+	if ok {
28
+		result := []string{}
29
+		seen := map[string]string{}
30
+
31
+		for _, val := range s[key] {
32
+			if _, ok := seen[val]; !ok {
33
+				result = append(result, val)
34
+				seen[val] = val
35
+			}
36
+		}
37
+
38
+		return result
39
+	}
40
+
41
+	return []string{}
42
+}
43
+
44
+func (s directorySet) AddAndGet(key string, value []string) []string {
45
+	s.Add(key, value)
46
+	return s.Get(key)
47
+}
48
+
49
+func (s directorySet) Filled(key string) bool {
50
+	return len(s[key]) > 0
51
+}

+ 84 - 0
modules/options/static.go

@@ -0,0 +1,84 @@
1
+// +build bindata
2
+
3
+// Copyright 2016 The Gitea Authors. All rights reserved.
4
+// Use of this source code is governed by a MIT-style
5
+// license that can be found in the LICENSE file.
6
+
7
+package options
8
+
9
+import (
10
+	"fmt"
11
+	"io/ioutil"
12
+	"path"
13
+
14
+	"code.gitea.io/gitea/modules/setting"
15
+	"github.com/Unknwon/com"
16
+)
17
+
18
+var (
19
+	directories = make(directorySet)
20
+)
21
+
22
+// Dir returns all files from bindata or custom directory.
23
+func Dir(name string) ([]string, error) {
24
+	if directories.Filled(name) {
25
+		return directories.Get(name), nil
26
+	}
27
+
28
+	var (
29
+		result []string
30
+	)
31
+
32
+	customDir := path.Join(setting.CustomPath, "options", name)
33
+
34
+	if com.IsDir(customDir) {
35
+		files, err := com.StatDir(customDir, true)
36
+
37
+		if err != nil {
38
+			return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
39
+		}
40
+
41
+		result = append(result, files...)
42
+	}
43
+
44
+	files, err := AssetDir(path.Join("..", "..", "options", name))
45
+
46
+	if err != nil {
47
+		return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err)
48
+	}
49
+
50
+	result = append(result, files...)
51
+
52
+	return directories.AddAndGet(name, result), nil
53
+}
54
+
55
+// Locale reads the content of a specific locale from bindata or custom path.
56
+func Locale(name string) ([]byte, error) {
57
+	return fileFromDir(path.Join("locale", name))
58
+}
59
+
60
+// Readme reads the content of a specific readme from bindata or custom path.
61
+func Readme(name string) ([]byte, error) {
62
+	return fileFromDir(path.Join("readme", name))
63
+}
64
+
65
+// Gitignore reads the content of a gitignore locale from bindata or custom path.
66
+func Gitignore(name string) ([]byte, error) {
67
+	return fileFromDir(path.Join("gitignore", name))
68
+}
69
+
70
+// License reads the content of a specific license from bindata or custom path.
71
+func License(name string) ([]byte, error) {
72
+	return fileFromDir(path.Join("license", name))
73
+}
74
+
75
+// fileFromDir is a helper to read files from bindata or custom path.
76
+func fileFromDir(name string) ([]byte, error) {
77
+	customPath := path.Join(setting.CustomPath, "options", name)
78
+
79
+	if com.IsFile(customPath) {
80
+		return ioutil.ReadFile(customPath)
81
+	}
82
+
83
+	return Asset(name)
84
+}

+ 25 - 10
modules/setting/setting.go

@@ -17,6 +17,8 @@ import (
17 17
 	"strings"
18 18
 	"time"
19 19
 
20
+	"code.gitea.io/gitea/modules/log"
21
+	"code.gitea.io/gitea/modules/user"
20 22
 	"github.com/Unknwon/com"
21 23
 	_ "github.com/go-macaron/cache/memcache" // memcache plugin for cache
22 24
 	_ "github.com/go-macaron/cache/redis"
@@ -25,10 +27,6 @@ import (
25 27
 	_ "github.com/kardianos/minwinsvc"      // import minwinsvc for windows services
26 28
 	"gopkg.in/ini.v1"
27 29
 	"strk.kbt.io/projects/go/libravatar"
28
-
29
-	"code.gitea.io/gitea/modules/bindata"
30
-	"code.gitea.io/gitea/modules/log"
31
-	"code.gitea.io/gitea/modules/user"
32 30
 )
33 31
 
34 32
 // Scheme describes protocol types
@@ -349,9 +347,10 @@ func NewContext() {
349 347
 		log.Fatal(4, "Fail to get work directory: %v", err)
350 348
 	}
351 349
 
352
-	Cfg, err = ini.Load(bindata.MustAsset("conf/app.ini"))
350
+	Cfg = ini.Empty()
351
+
353 352
 	if err != nil {
354
-		log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
353
+		log.Fatal(4, "Fail to parse 'app.ini': %v", err)
355 354
 	}
356 355
 
357 356
 	CustomPath = os.Getenv("GITEA_CUSTOM")
@@ -444,6 +443,10 @@ please consider changing to GITEA_CUSTOM`)
444 443
 	if err = Cfg.Section("server").MapTo(&SSH); err != nil {
445 444
 		log.Fatal(4, "Fail to map SSH settings: %v", err)
446 445
 	}
446
+
447
+	SSH.KeygenPath = sec.Key("SSH_KEYGEN_PATH").MustString("ssh-keygen")
448
+	SSH.Port = sec.Key("SSH_PORT").MustInt(22)
449
+
447 450
 	// When disable SSH, start builtin server value is ignored.
448 451
 	if SSH.Disabled {
449 452
 		SSH.StartBuiltinServer = false
@@ -502,7 +505,7 @@ please consider changing to GITEA_CUSTOM`)
502 505
 		"StampNano":   time.StampNano,
503 506
 	}[Cfg.Section("time").Key("FORMAT").MustString("RFC1123")]
504 507
 
505
-	RunUser = Cfg.Section("").Key("RUN_USER").String()
508
+	RunUser = Cfg.Section("").Key("RUN_USER").MustString(user.CurrentUsername())
506 509
 	// Does not check run user when the install lock is off.
507 510
 	if InstallLock {
508 511
 		currentUser, match := IsRunUserMatchCurrentUser(RunUser)
@@ -593,7 +596,17 @@ please consider changing to GITEA_CUSTOM`)
593 596
 	}
594 597
 
595 598
 	Langs = Cfg.Section("i18n").Key("LANGS").Strings(",")
599
+	if len(Langs) == 0 {
600
+		Langs = []string{
601
+			"en-US",
602
+		}
603
+	}
596 604
 	Names = Cfg.Section("i18n").Key("NAMES").Strings(",")
605
+	if len(Names) == 0 {
606
+		Names = []string{
607
+			"English",
608
+		}
609
+	}
597 610
 	dateLangs = Cfg.Section("i18n.datelang").KeysHash()
598 611
 
599 612
 	ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool()
@@ -639,16 +652,18 @@ var logLevels = map[string]string{
639 652
 }
640 653
 
641 654
 func newLogService() {
642
-	log.Info("%s %s", AppName, AppVer)
655
+	log.Info("Gitea v%s", AppVer)
643 656
 
644
-	// Get and check log mode.
645 657
 	LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
646 658
 	LogConfigs = make([]string, len(LogModes))
659
+
647 660
 	for i, mode := range LogModes {
648 661
 		mode = strings.TrimSpace(mode)
662
+
649 663
 		sec, err := Cfg.GetSection("log." + mode)
664
+
650 665
 		if err != nil {
651
-			log.Fatal(4, "Unknown log mode: %s", mode)
666
+			sec, _ = Cfg.NewSection("log." + mode)
652 667
 		}
653 668
 
654 669
 		validLevels := []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"}

conf/gitignore/Actionscript → options/gitignore/Actionscript


conf/gitignore/Ada → options/gitignore/Ada


conf/gitignore/Agda → options/gitignore/Agda


conf/gitignore/Android → options/gitignore/Android


conf/gitignore/Anjuta → options/gitignore/Anjuta


conf/gitignore/AppEngine → options/gitignore/AppEngine


conf/gitignore/AppceleratorTitanium → options/gitignore/AppceleratorTitanium


conf/gitignore/ArchLinuxPackages → options/gitignore/ArchLinuxPackages


conf/gitignore/Archives → options/gitignore/Archives


conf/gitignore/Autotools → options/gitignore/Autotools


conf/gitignore/BricxCC → options/gitignore/BricxCC


conf/gitignore/C → options/gitignore/C


conf/gitignore/C Sharp → options/gitignore/C Sharp


conf/gitignore/C++ → options/gitignore/C++


conf/gitignore/CFWheels → options/gitignore/CFWheels


conf/gitignore/CMake → options/gitignore/CMake


conf/gitignore/CUDA → options/gitignore/CUDA


conf/gitignore/CVS → options/gitignore/CVS


conf/gitignore/CakePHP → options/gitignore/CakePHP


conf/gitignore/ChefCookbook → options/gitignore/ChefCookbook


conf/gitignore/Cloud9 → options/gitignore/Cloud9


conf/gitignore/CodeIgniter → options/gitignore/CodeIgniter


conf/gitignore/CodeKit → options/gitignore/CodeKit


conf/gitignore/CommonLisp → options/gitignore/CommonLisp


conf/gitignore/Composer → options/gitignore/Composer


conf/gitignore/Concrete5 → options/gitignore/Concrete5


conf/gitignore/Coq → options/gitignore/Coq


conf/gitignore/CraftCMS → options/gitignore/CraftCMS


conf/gitignore/DM → options/gitignore/DM


conf/gitignore/Dart → options/gitignore/Dart


conf/gitignore/DartEditor → options/gitignore/DartEditor


conf/gitignore/Delphi → options/gitignore/Delphi


conf/gitignore/Dreamweaver → options/gitignore/Dreamweaver


conf/gitignore/Drupal → options/gitignore/Drupal


conf/gitignore/EPiServer → options/gitignore/EPiServer


conf/gitignore/Eagle → options/gitignore/Eagle


conf/gitignore/Eclipse → options/gitignore/Eclipse


conf/gitignore/EiffelStudio → options/gitignore/EiffelStudio


conf/gitignore/Elisp → options/gitignore/Elisp


conf/gitignore/Elixir → options/gitignore/Elixir


conf/gitignore/Emacs → options/gitignore/Emacs


conf/gitignore/Ensime → options/gitignore/Ensime


conf/gitignore/Erlang → options/gitignore/Erlang


conf/gitignore/Espresso → options/gitignore/Espresso


conf/gitignore/ExpressionEngine → options/gitignore/ExpressionEngine


conf/gitignore/ExtJs → options/gitignore/ExtJs


conf/gitignore/Fancy → options/gitignore/Fancy


conf/gitignore/Finale → options/gitignore/Finale


conf/gitignore/FlexBuilder → options/gitignore/FlexBuilder


conf/gitignore/ForceDotCom → options/gitignore/ForceDotCom


conf/gitignore/FuelPHP → options/gitignore/FuelPHP


conf/gitignore/GWT → options/gitignore/GWT


conf/gitignore/Gcov → options/gitignore/Gcov


conf/gitignore/GitBook → options/gitignore/GitBook


conf/gitignore/Go → options/gitignore/Go


conf/gitignore/Gradle → options/gitignore/Gradle


conf/gitignore/Grails → options/gitignore/Grails


conf/gitignore/Haskell → options/gitignore/Haskell


conf/gitignore/IGORPro → options/gitignore/IGORPro


conf/gitignore/IPythonNotebook → options/gitignore/IPythonNotebook


conf/gitignore/Idris → options/gitignore/Idris


conf/gitignore/JDeveloper → options/gitignore/JDeveloper


conf/gitignore/Java → options/gitignore/Java


conf/gitignore/Jboss → options/gitignore/Jboss


conf/gitignore/Jekyll → options/gitignore/Jekyll


conf/gitignore/JetBrains → options/gitignore/JetBrains


conf/gitignore/Joomla → options/gitignore/Joomla


conf/gitignore/KDevelop4 → options/gitignore/KDevelop4


conf/gitignore/Kate → options/gitignore/Kate


conf/gitignore/KiCAD → options/gitignore/KiCAD


conf/gitignore/Kohana → options/gitignore/Kohana


conf/gitignore/LabVIEW → options/gitignore/LabVIEW


conf/gitignore/Laravel → options/gitignore/Laravel


conf/gitignore/Lazarus → options/gitignore/Lazarus


conf/gitignore/Leiningen → options/gitignore/Leiningen


conf/gitignore/LemonStand → options/gitignore/LemonStand


conf/gitignore/LibreOffice → options/gitignore/LibreOffice


conf/gitignore/Lilypond → options/gitignore/Lilypond


conf/gitignore/Linux → options/gitignore/Linux


conf/gitignore/Lithium → options/gitignore/Lithium


conf/gitignore/Lua → options/gitignore/Lua


conf/gitignore/LyX → options/gitignore/LyX


conf/gitignore/Magento → options/gitignore/Magento


conf/gitignore/Matlab → options/gitignore/Matlab


conf/gitignore/Maven → options/gitignore/Maven


conf/gitignore/Mercurial → options/gitignore/Mercurial


conf/gitignore/Mercury → options/gitignore/Mercury


+ 0 - 0
conf/gitignore/MetaProgrammingSystem


Some files were not shown because too many files changed in this diff