beego: support other config provider
Showing
1 changed file
with
4 additions
and
1 deletions
| ... | @@ -70,6 +70,7 @@ var ( | ... | @@ -70,6 +70,7 @@ var ( |
| 70 | AdminHttpPort int | 70 | AdminHttpPort int |
| 71 | FlashName string // name of the flash variable found in response header and cookie | 71 | FlashName string // name of the flash variable found in response header and cookie |
| 72 | FlashSeperator string // used to seperate flash key:value | 72 | FlashSeperator string // used to seperate flash key:value |
| 73 | AppConfigProvider string // config provider | ||
| 73 | ) | 74 | ) |
| 74 | 75 | ||
| 75 | func init() { | 76 | func init() { |
| ... | @@ -91,6 +92,8 @@ func init() { | ... | @@ -91,6 +92,8 @@ func init() { |
| 91 | } | 92 | } |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 95 | AppConfigProvider = "ini" | ||
| 96 | |||
| 94 | StaticDir = make(map[string]string) | 97 | StaticDir = make(map[string]string) |
| 95 | StaticDir["/static"] = "static" | 98 | StaticDir["/static"] = "static" |
| 96 | 99 | ||
| ... | @@ -170,7 +173,7 @@ func init() { | ... | @@ -170,7 +173,7 @@ func init() { |
| 170 | // ParseConfig parsed default config file. | 173 | // ParseConfig parsed default config file. |
| 171 | // now only support ini, next will support json. | 174 | // now only support ini, next will support json. |
| 172 | func ParseConfig() (err error) { | 175 | func ParseConfig() (err error) { |
| 173 | AppConfig, err = config.NewConfig("ini", AppConfigPath) | 176 | AppConfig, err = config.NewConfig(AppConfigProvider, AppConfigPath) |
| 174 | if err != nil { | 177 | if err != nil { |
| 175 | AppConfig = config.NewFakeConfig() | 178 | AppConfig = config.NewFakeConfig() |
| 176 | return err | 179 | return err | ... | ... |
-
Please register or sign in to post a comment