forked from dreamlu/deercoder-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevMode.sh
More file actions
executable file
·37 lines (32 loc) · 913 Bytes
/
devMode.sh
File metadata and controls
executable file
·37 lines (32 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# 开发模式 dev/prod
# 此处修改模式
# 执行该脚本
# dev模式
# 前后端api接口地址
devMode=dev
api=localhost:8006
httpProtocol=http
wsProtocol=ws
# prod模式
#devMode=prod
#api=chat.deercoder.com
#httpProtocol=https
#wsProtocol=wss
# 后端配置文件地址
# 修改各个模块下app.conf文件开发模式
confFiles=(api/conf/app.yaml chat-srv/conf/app.yaml user-srv/conf/app.yaml front-srv/conf/app.yaml)
# 前端配置文件地址
apiFile=front-srv/static/js/chat.js
# 后端conf配置修改
for conf in ${confFiles[@]}
#也可以写成for element in ${array[*]}
do
echo "配置文件: "${conf}
# 替换源文件第二行内容
sed -i '3c \ \devMode: '${devMode} "${conf}"
done
# 前端api修改
sed -i '2c var api = "'${api}'";' ${apiFile}
sed -i '3c var httpProtocol = "'${httpProtocol}'";' ${apiFile}
sed -i '4c var wsProtocol = "'${wsProtocol}'";' ${apiFile}