Skip to content

Commit

Permalink
Merge pull request #11 from wk331100/1.0.0
Browse files Browse the repository at this point in the history
modify env file
  • Loading branch information
wk331100 authored Aug 3, 2021
2 parents fd6938c + 037bfa5 commit f6ef721
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
38 changes: 19 additions & 19 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
redis_slave1_host=127.0.0.1
redis_slave1_port=6379
redis_slave1_password=123456
redis_slave1_db=0
16 changes: 8 additions & 8 deletions config/Redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
}
}
Expand Down
20 changes: 10 additions & 10 deletions config/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}

0 comments on commit f6ef721

Please sign in to comment.