CasaOS/service/docker_base/common.go

25 lines
622 B
Go
Raw Normal View History

2021-09-26 02:35:02 +00:00
package docker_base
2021-09-27 06:17:36 +00:00
import "github.com/IceWhaleTech/CasaOS/model"
2021-09-26 02:35:02 +00:00
//过滤mysql关键字
func MysqlFilter(c MysqlConfig, envs model.EnvArray) model.EnvArray {
2021-09-26 02:35:02 +00:00
for i := 0; i < len(envs); i++ {
switch envs[i].Value {
case "$MYSQL_HOST":
envs[i].Value = c.DataBaseHost
case "$MYSQL_PORT":
envs[i].Value = c.DataBasePort
case "$MYSQL_USERNAME":
envs[i].Value = c.DataBaseUser
case "$MYSQL_PASSWORD":
envs[i].Value = c.DataBasePassword
case "$MYSQL_DBNAME":
envs[i].Value = c.DataBaseDB
case "$MYSQL_HOST_AND_PORT":
envs[i].Value = c.DataBaseHost + ":" + c.DataBasePort
}
}
return envs
}