update default conf
This commit is contained in:
@ -65,9 +65,15 @@ func Init(url, dbname string) {
|
|||||||
url, ok = config.String("db.url")
|
url, ok = config.String("db.url")
|
||||||
if !ok {
|
if !ok {
|
||||||
url, ok = config.String("db.urlEnv")
|
url, ok = config.String("db.urlEnv")
|
||||||
|
if ok {
|
||||||
|
Log("get db conf from urlEnv: " + url)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log("get db conf from db.url: " + url)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
// get dbname from url
|
// get dbname from urlEnv
|
||||||
urls := strings.Split(url, "/")
|
urls := strings.Split(url, "/")
|
||||||
dbname = urls[len(urls)-1]
|
dbname = urls[len(urls)-1]
|
||||||
}
|
}
|
||||||
@ -75,6 +81,8 @@ func Init(url, dbname string) {
|
|||||||
if dbname == "" {
|
if dbname == "" {
|
||||||
dbname, _ = config.String("db.dbname")
|
dbname, _ = config.String("db.dbname")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get db config from host, port, username, password
|
||||||
if !ok {
|
if !ok {
|
||||||
host, _ := revel.Config.String("db.host")
|
host, _ := revel.Config.String("db.host")
|
||||||
port, _ := revel.Config.String("db.port")
|
port, _ := revel.Config.String("db.port")
|
||||||
|
@ -15,10 +15,10 @@ db.port=27017
|
|||||||
db.dbname=leanote # required
|
db.dbname=leanote # required
|
||||||
db.username= # if not exists, please leave it blank
|
db.username= # if not exists, please leave it blank
|
||||||
db.password= # if not exists, please leave it blank
|
db.password= # if not exists, please leave it blank
|
||||||
# or you can set the mongdb url for more complex needs the format is:
|
# or you can set the mongodb url for more complex needs the format is:
|
||||||
# mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
|
# mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
|
||||||
# db.url=mongodb://root:root123@localhost:27017/leanote
|
# db.url=mongodb://root:root123@localhost:27017/leanote
|
||||||
db.urlEnv=${MONGODB_URL} # set url from env
|
# db.urlEnv=${MONGODB_URL} # set url from env
|
||||||
|
|
||||||
# You Must Change It !! About Security!!
|
# You Must Change It !! About Security!!
|
||||||
app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y
|
app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y
|
||||||
@ -32,7 +32,7 @@ http.addr=
|
|||||||
http.ssl=false
|
http.ssl=false
|
||||||
cookie.httponly=false
|
cookie.httponly=false
|
||||||
cookie.prefix=LEANOTE
|
cookie.prefix=LEANOTE
|
||||||
cookie.domain= # for share cookie with subdomain, 默认为空, 即不设置 不能设置为localhost, 要么就为空
|
cookie.domain= # for share cookie with sub-domain
|
||||||
cookie.secure=false
|
cookie.secure=false
|
||||||
format.date=01/02/2006
|
format.date=01/02/2006
|
||||||
format.datetime=01/02/2006 15:04
|
format.datetime=01/02/2006 15:04
|
||||||
|
Reference in New Issue
Block a user