diff --git a/etc/app.ini.example b/etc/app.ini.example index 720a4af8e375da6fdcdc9e3c46971dee0d3a9eb7..872f4f9436f3509f107c7690e133d2784ee02829 100644 --- a/etc/app.ini.example +++ b/etc/app.ini.example @@ -20,7 +20,7 @@ ExpireMinute = 100 [micro-mall-mysql] Host = "127.0.0.1:3306" UserName = "root" -Password = "07030501310" +Password = "oyuioyuioy" DBName = "micro_mall" Charset = "utf8mb4" PoolNum = 10 @@ -31,12 +31,12 @@ ParseTime = true [micro-mall-redis] Host = "127.0.0.1:6379" -Password = "07030501310" +Password = "oyuioyiuoyui" DB = 1 PoolNum = 10 [email-config] -User = "xxx@qq.com" +User = "xxxx@qq.com" Password = "xxxx" Host = "smtp.qq.com" Port = "465" \ No newline at end of file diff --git a/go.mod b/go.mod index 8ca131ab749a94ce201d917f6527647b9f615d7a..9aa80b0fa9e36fe6a864a24d2d1c904c7ab120de 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( gitee.com/kelvins-io/common v1.0.4 - gitee.com/kelvins-io/kelvins v1.2.2 + gitee.com/kelvins-io/kelvins v1.2.5 github.com/RichardKnop/machinery v1.9.1 github.com/astaxie/beego v1.12.2 github.com/cloudflare/tableflip v1.2.2 diff --git a/go.sum b/go.sum index e86fe65b2c154f35098fc69ba696e8560ae3f264..5a53e80aad3983393123d12d5e92c264dccbddd2 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ gitee.com/kelvins-io/kelvins v1.1.3 h1:Z3G657Cw+8SxKdkimg5uke7bkaObENKU7BrGzDM1a gitee.com/kelvins-io/kelvins v1.1.3/go.mod h1:JWjwU4Htjti5Z9CMIb4/Os3HNSSXFe2QTHuwoc25wxM= gitee.com/kelvins-io/kelvins v1.2.2 h1:2IUF0XXMw1MwDFP2wqlez/fzLk8yaFcHAN2cEWdDFP8= gitee.com/kelvins-io/kelvins v1.2.2/go.mod h1:/cOR+5JJ59iAGwzS9B9e+EmfhNps4OrWT4mR6CIXcpY= +gitee.com/kelvins-io/kelvins v1.2.5 h1:uY+7vYou8mR0AwhRwc30zKyw/BGfkCUL+Fb9TDRW/eI= +gitee.com/kelvins-io/kelvins v1.2.5/go.mod h1:bsooNB8hqJDN+c3dW8ps85zu35wc7Wztcg+eukSqKmI= gitee.com/kelvins-io/service-config v1.0.0/go.mod h1:htuk7Oj0ifRcwgqSJf45IsN1rSq9kEsje/fcQClQS+Y= github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.1 h1:j56fC19WoD3z+u+ZHxm2XwRGyS1XmdSMk7058BLhdsM= github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.1/go.mod h1:gXEhMjm1VadSGjAzyDlBxmdYglP8eJpYWxpwJnmXRWw= diff --git a/internal/config/config.go b/internal/config/config.go index 6ef2883df2b1b325c7e4504a9d6d06f803a0c1de..e7828a8325fe6fded7b9cec2dca0761b6acb5a4f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,6 +1,7 @@ package config import ( + "flag" "gitee.com/cristiane/micro-mall-api/config/setting" "gitee.com/cristiane/micro-mall-api/vars" "log" @@ -24,13 +25,21 @@ const ( ) // cfg reads file app.ini. -var cfg *ini.File +var ( + cfg *ini.File + flagConf = flag.String("conf_file", "", "Set app config.") +) // LoadDefaultConfig loads config form cfg. func LoadDefaultConfig(application *vars.Application) error { // Setup cfg object + flag.Parse() var err error - cfg, err = ini.Load(ConfFileName) + var confFile = ConfFileName + if *flagConf != "" { + confFile = *flagConf + } + cfg, err = ini.Load(confFile) if err != nil { return err }