Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:pwnsky/squick into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
i0gan committed Oct 5, 2024
2 parents aa662bb + 897da4e commit a20f26b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions script/env.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set SQUICK_RUN_ENV=ten
14 changes: 8 additions & 6 deletions script/gen_env_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

print('Gen env: ' + env)

package_list = {}
tmpl_path = '../config/tmpl'
tmpl_value_path = '../config/tmpl/env'
cfg_path = '../config/node'

cfg_map = {}
cfg_value_map = {}
conf_content = ''

def GetFileContent(path):
fd = open(path, 'r')
Expand All @@ -29,13 +28,13 @@ def GetFileContent(path):
cfg_map[f] = GetFileContent(tmpl_path + '/' + f)
elif f.endswith('.conf'):
print("conf file: ", f)
cfg_value_map[f] = GetFileContent(tmpl_path + '/env/' + f)
if f == env + '.conf':
conf_content = GetFileContent(tmpl_path + '/env/' + f)


# replace
for k in cfg_value_map:
conf_file = cfg_value_map[k]
conf_arr = conf_file.split('\n')
if (len(conf_content) > 0):
conf_arr = conf_content.split('\n')
for conf_line in conf_arr:
conf = conf_line.split('=')
if len(conf) < 2:
Expand All @@ -46,6 +45,9 @@ def GetFileContent(path):
tmp = cfg_map[k2]
tmp = tmp.replace('{' + key + '}', value)
cfg_map[k2] = tmp
else:
print("Get " + env + " error")
exit(-1)

# save
for k in cfg_map:
Expand Down
3 changes: 3 additions & 0 deletions script/squick.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ rem Date : 2022-11-27
rem Github: https://github.com/pwnsky/squick
rem Description: Start all servers script

call env.bat
python gen_env_config.py %SQUICK_RUN_ENV%

cd ..\bin

start /b .\squick
3 changes: 3 additions & 0 deletions script/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ rem Date : 2024-04-08
rem Github: https://github.com/pwnsky/squick
rem Description: Start all nodes

call env.bat
python gen_env_config.py %SQUICK_RUN_ENV%

cd ..\bin

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

0 comments on commit a20f26b

Please sign in to comment.