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关键字
|
2021-11-03 09:07:46 +00:00
|
|
|
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
|
|
|
|
}
|