From a0088ead9ebd1c8de46355ae2640671833f3ad6d Mon Sep 17 00:00:00 2001 From: lealife Date: Wed, 7 Oct 2015 00:28:35 +0800 Subject: [PATCH] update default conf --- app/db/Mgo.go | 10 +++++++++- conf/app.conf | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/db/Mgo.go b/app/db/Mgo.go index 9b79dd2..ee6ea03 100644 --- a/app/db/Mgo.go +++ b/app/db/Mgo.go @@ -65,9 +65,15 @@ func Init(url, dbname string) { url, ok = config.String("db.url") if !ok { 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 { - // get dbname from url + // get dbname from urlEnv urls := strings.Split(url, "/") dbname = urls[len(urls)-1] } @@ -75,6 +81,8 @@ func Init(url, dbname string) { if dbname == "" { dbname, _ = config.String("db.dbname") } + + // get db config from host, port, username, password if !ok { host, _ := revel.Config.String("db.host") port, _ := revel.Config.String("db.port") diff --git a/conf/app.conf b/conf/app.conf index 51d051c..ea856d2 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -15,10 +15,10 @@ db.port=27017 db.dbname=leanote # required db.username= # 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 # 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!! app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y @@ -32,7 +32,7 @@ http.addr= http.ssl=false cookie.httponly=false cookie.prefix=LEANOTE -cookie.domain= # for share cookie with subdomain, 默认为空, 即不设置 不能设置为localhost, 要么就为空 +cookie.domain= # for share cookie with sub-domain cookie.secure=false format.date=01/02/2006 format.datetime=01/02/2006 15:04