Skip to content

Commit a20f26b

Browse files
committed
Merge branch 'dev' of github.com:pwnsky/squick into dev
2 parents aa662bb + 897da4e commit a20f26b

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

script/env.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set SQUICK_RUN_ENV=ten

script/gen_env_config.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
print('Gen env: ' + env)
1212

13-
package_list = {}
1413
tmpl_path = '../config/tmpl'
1514
tmpl_value_path = '../config/tmpl/env'
1615
cfg_path = '../config/node'
1716

1817
cfg_map = {}
19-
cfg_value_map = {}
18+
conf_content = ''
2019

2120
def GetFileContent(path):
2221
fd = open(path, 'r')
@@ -29,13 +28,13 @@ def GetFileContent(path):
2928
cfg_map[f] = GetFileContent(tmpl_path + '/' + f)
3029
elif f.endswith('.conf'):
3130
print("conf file: ", f)
32-
cfg_value_map[f] = GetFileContent(tmpl_path + '/env/' + f)
31+
if f == env + '.conf':
32+
conf_content = GetFileContent(tmpl_path + '/env/' + f)
3333

3434

3535
# replace
36-
for k in cfg_value_map:
37-
conf_file = cfg_value_map[k]
38-
conf_arr = conf_file.split('\n')
36+
if (len(conf_content) > 0):
37+
conf_arr = conf_content.split('\n')
3938
for conf_line in conf_arr:
4039
conf = conf_line.split('=')
4140
if len(conf) < 2:
@@ -46,6 +45,9 @@ def GetFileContent(path):
4645
tmp = cfg_map[k2]
4746
tmp = tmp.replace('{' + key + '}', value)
4847
cfg_map[k2] = tmp
48+
else:
49+
print("Get " + env + " error")
50+
exit(-1)
4951

5052
# save
5153
for k in cfg_map:

script/squick.bat

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ rem Date : 2022-11-27
55
rem Github: https://github.com/pwnsky/squick
66
rem Description: Start all servers script
77

8+
call env.bat
9+
python gen_env_config.py %SQUICK_RUN_ENV%
10+
811
cd ..\bin
912

1013
start /b .\squick

script/start.bat

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ rem Date : 2024-04-08
55
rem Github: https://github.com/pwnsky/squick
66
rem Description: Start all nodes
77

8+
call env.bat
9+
python gen_env_config.py %SQUICK_RUN_ENV%
10+
811
cd ..\bin
912

1013
start cmd /c " squick type=master id=1 area=0 ip=127.0.0.1 port=10001 web_port=50000"

0 commit comments

Comments
 (0)