conf script

This commit is contained in:
wangchuxiao 2022-11-14 18:03:44 +08:00
parent a314f2d1cb
commit bfeb434920
2 changed files with 5 additions and 15 deletions

View File

@ -1,7 +1,7 @@
etcd: etcd:
userName: userName:
password: password:
secret: # etcd 配置密钥 secret: openIM123 # etcd 配置密钥
mysql: mysql:
dbMysqlUserName: root #mysql用户名建议修改 dbMysqlUserName: root #mysql用户名建议修改

View File

@ -1,18 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source ../.env source ../.env
echo "user:{$USER}" echo "your user is:$USER"
echo "password:{$PASSWORD}" echo "your password is:$PASSWORD"
nameList=(dbMysqlUserName dbUserName dbUserName accessKeyID) sed -i "/^\([[:space:]]*dbMysqlUserName: *\).*/s//\1$USER/;/\([[:space:]]*dbUserName: *\).*/s//\1 $USER/;/\([[:space:]]*accessKeyID: *\).*/s//\1$USER/;" ../config/usualConfig.yaml
pwdList=(dbMysqlPassword dbPassword dbPassWord secretAccessKey) sed -i "/^\([[:space:]]*dbMysqlPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*dbPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*dbPassWord: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secretAccessKey: *\).*/s//\1$PASSWORD/;" ../config/usualConfig.yaml
for i in ${nameList[*]}; do
echo {$i}
sed -i 's/{$i}: [a-z]/{$i}: {$USER}/g' ../config/usualConfig.yaml
done
for i in ${pwdList[*]}; do
echo {$i}
sed -i 's/{$i}: [a-z]/{$i}: {$PASSWORD}/g' ../config/usualConfig.yaml
done