优化router、main等文件。
This commit is contained in:
+4
-2
@@ -19,8 +19,9 @@ type DatabaseConfig struct {
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
Port int
|
||||
Mode string
|
||||
Port int
|
||||
Mode string
|
||||
LogLevel string // 日志级别:debug/info/warn/error,默认 info
|
||||
}
|
||||
|
||||
type AppConfig struct {
|
||||
@@ -70,6 +71,7 @@ func Load() *Config {
|
||||
func setDefaults() {
|
||||
viper.SetDefault("server.port", 8080)
|
||||
viper.SetDefault("server.mode", "debug")
|
||||
viper.SetDefault("server.log_level", "info")
|
||||
viper.SetDefault("database.driver", "sqlite")
|
||||
viper.SetDefault("database.dsn", "goblog.db")
|
||||
viper.SetDefault("app.name", "GoBlog")
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
server:
|
||||
port: 8080
|
||||
mode: debug # debug 或 release
|
||||
log_level: info # info, warn, error
|
||||
|
||||
database:
|
||||
driver: sqlite # sqlite 或 mysql
|
||||
|
||||
Reference in New Issue
Block a user