Put default config into binary
This commit is contained in:
parent
deee2d5fa8
commit
e6cf83b8c0
7 changed files with 1097 additions and 53 deletions
1041
modules/bindata/bindata.go
Normal file
1041
modules/bindata/bindata.go
Normal file
File diff suppressed because one or more lines are too long
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/macaron-contrib/session"
|
||||
"gopkg.in/ini.v1"
|
||||
|
||||
"github.com/gogits/gogs/modules/bindata"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
// "github.com/gogits/gogs/modules/ssh"
|
||||
)
|
||||
|
@ -131,7 +132,6 @@ var (
|
|||
|
||||
// Global setting objects.
|
||||
Cfg *ini.File
|
||||
ConfRootPath string
|
||||
CustomPath string // Custom directory path.
|
||||
CustomConf string
|
||||
ProdMode bool
|
||||
|
@ -165,8 +165,7 @@ func WorkDir() (string, error) {
|
|||
|
||||
func forcePathSeparator(path string) {
|
||||
if strings.Contains(path, "\\") {
|
||||
fmt.Println("Do not use '\\' or '\\\\' in paths, instead, please use '/' in all places")
|
||||
os.Exit(1)
|
||||
log.Fatal(4, "Do not use '\\' or '\\\\' in paths, instead, please use '/' in all places")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,9 +176,8 @@ func NewConfigContext() {
|
|||
if err != nil {
|
||||
log.Fatal(4, "Fail to get work directory: %v", err)
|
||||
}
|
||||
ConfRootPath = path.Join(workDir, "conf")
|
||||
|
||||
Cfg, err = ini.Load(path.Join(workDir, "conf/app.ini"))
|
||||
Cfg, err = ini.Load(bindata.MustAsset("conf/app.ini"))
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue