diff --git a/.env b/.env index b6edc66..dcbc806 100644 --- a/.env +++ b/.env @@ -5,30 +5,30 @@ log_type=error time_location=asia/shanghai [SERVER] -port=80 +server_port=80 [DB_MASTER] -host=127.0.0.1 -port=3306 -username=root -password=123456 -dbname=test +db_host=127.0.0.1 +db_port=3306 +db_username=root +db_password=123456 +db_dbname=test [DB_SLAVE] -host=127.0.0.1 -port=3306 -username=root -password=123456 -dbname=test +db_slave_host=127.0.0.1 +db_slave_port=3306 +db_slave_username=root +db_slave_password=123456 +db_slave_dbname=test [REDIS_MASTER] -host=127.0.0.1 -port=6379 -password=123456 -db=0 +redis_host=127.0.0.1 +redis_port=6379 +redis_password=123456 +redis_db=0 [REDIS_SLAVE1] -host=127.0.0.1 -port=6379 -password=123456 -db=0 \ No newline at end of file +redis_slave1_host=127.0.0.1 +redis_slave1_port=6379 +redis_slave1_password=123456 +redis_slave1_db=0 \ No newline at end of file diff --git a/config/Redis.go b/config/Redis.go index 38caf52..9eaced4 100644 --- a/config/Redis.go +++ b/config/Redis.go @@ -7,16 +7,16 @@ var RedisConfig = helper.Map{} func InitRedisConfig(){ RedisConfig = helper.Map{ "master" : helper.Map{ - "host" : helper.Env("host", "REDIS_MASTER"), - "port" : helper.EnvInt("port", "REDIS_MASTER"), - "password" : helper.Env("password", "REDIS_MASTER"), - "db" : helper.EnvInt("db", "REDIS_MASTER"), + "host" : helper.Env("redis_host", "REDIS_MASTER"), + "port" : helper.EnvInt("redis_port", "REDIS_MASTER"), + "password" : helper.Env("redis_password", "REDIS_MASTER"), + "db" : helper.EnvInt("redis_db", "REDIS_MASTER"), }, "slave1" : helper.Map{ - "host" : helper.Env("host", "REDIS_SLAVE1"), - "port" : helper.EnvInt("port", "REDIS_SLAVE1"), - "password" : helper.Env("password", "REDIS_SLAVE1"), - "db" : helper.EnvInt("db", "REDIS_SLAVE1"), + "host" : helper.Env("redis_slave1_host", "REDIS_SLAVE1"), + "port" : helper.EnvInt("redis_slave1_port", "REDIS_SLAVE1"), + "password" : helper.Env("redis_slave1_password", "REDIS_SLAVE1"), + "db" : helper.EnvInt("redis_slave1_db", "REDIS_SLAVE1"), }, } } diff --git a/config/database.go b/config/database.go index db252f6..9133009 100644 --- a/config/database.go +++ b/config/database.go @@ -7,18 +7,18 @@ var MysqlConfig = helper.Map{} func InitDatabaseConfig(){ MysqlConfig = helper.Map{ "master" : helper.Map{ - "host" : helper.Env("host", "DB_MASTER"), - "port" : helper.EnvInt("port", "DB_MASTER"), - "username" : helper.Env("username", "DB_MASTER"), - "password" : helper.Env("password", "DB_MASTER"), - "dbname" : helper.Env("dbname", "DB_MASTER"), + "host" : helper.Env("db_host", "DB_MASTER"), + "port" : helper.EnvInt("db_port", "DB_MASTER"), + "username" : helper.Env("db_username", "DB_MASTER"), + "password" : helper.Env("db_password", "DB_MASTER"), + "dbname" : helper.Env("db_dbname", "DB_MASTER"), }, "slave" : helper.Map{ - "host" : helper.Env("host", "DB_SLAVE"), - "port" : helper.EnvInt("port", "DB_SLAVE"), - "username" : helper.Env("username", "DB_SLAVE"), - "password" : helper.Env("password", "DB_SLAVE"), - "dbname" : helper.Env("dbname", "DB_SLAVE"), + "host" : helper.Env("db_slave_host", "DB_SLAVE"), + "port" : helper.EnvInt("db_slave_port", "DB_SLAVE"), + "username" : helper.Env("db_slave_username", "DB_SLAVE"), + "password" : helper.Env("db_slave_password", "DB_SLAVE"), + "dbname" : helper.Env("db_slave_dbname", "DB_SLAVE"), }, } } diff --git a/config/server.go b/config/server.go index 15642e1..bd119f9 100644 --- a/config/server.go +++ b/config/server.go @@ -8,6 +8,6 @@ var ServerConfig = map[string]interface{}{ func InitServerConfig() { ServerConfig = helper.Map{ - "port" : helper.EnvInt("port", "SERVER"), + "port" : helper.EnvInt("server_port", "SERVER"), } } \ No newline at end of file