Ver Fonte

修改config参数命名规范

huangyh há 6 anos atrás
pai
commit
71436d0ef0
2 ficheiros alterados com 9 adições e 9 exclusões
  1. 6 6
      config/config.go
  2. 3 3
      utils/pwd.go

+ 6 - 6
config/config.go

@@ -32,12 +32,12 @@ func ParseConfig() {
 		AppConfig.SyncDb = true
 		AppConfig.AutoRefresh = false
 	} else {
-		AppConfig.AppName = _config.String("appname", "")
-		AppConfig.HttpPort = _config.Integer("httpport", 8080)
-		AppConfig.LogMode = _config.String("logmode", "debug")
-		AppConfig.RunMode = _config.String("runmode", "debug")
-		AppConfig.DataSource = _config.String("datasource", "")
-		AppConfig.SyncDb = _config.Boolean("syncDb", true)
+		AppConfig.AppName = _config.String("app_name", "")
+		AppConfig.HttpPort = _config.Integer("http_port", 8080)
+		AppConfig.LogMode = _config.String("log_mode", "debug")
+		AppConfig.RunMode = _config.String("run_mode", "debug")
+		AppConfig.DataSource = _config.String("data_source", "")
+		AppConfig.SyncDb = _config.Boolean("sync_db", true)
 		AppConfig.AutoRefresh = _config.Boolean("auto_refresh", false)
 	}
 

+ 3 - 3
utils/pwd.go

@@ -16,9 +16,9 @@ import (
 
 func HashPassword(password, salt string) string {
 	h := md5.New()
-	enableDbSalt := config.AppConfig.GetBool("EnableDBSalt", true)
-	customSalt := config.AppConfig.GetKey("PasswordSalt")
-	enableBase64 := config.AppConfig.GetBool("PasswordEnableBase64", true)
+	enableDbSalt := config.AppConfig.GetBool("enable_db_salt", true)
+	customSalt := config.AppConfig.GetKey("password_salt")
+	enableBase64 := config.AppConfig.GetBool("password_enable_base64", true)
 
 	if !enableDbSalt {
 		h.Write([]byte(password))