fix gunicorn bind replace

This commit is contained in:
Gerrit Gogel 2021-01-21 02:33:38 +01:00
parent 9480545f5d
commit 993725aa10

View file

@ -47,6 +47,7 @@ def fix_gunicorn_bind():
if os.path.exists(join(shared_seafiledir, 'conf', 'gunicorn.conf.py')): if os.path.exists(join(shared_seafiledir, 'conf', 'gunicorn.conf.py')):
with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'r') as fp: with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'r') as fp:
fp_lines = fp.readlines() fp_lines = fp.readlines()
if 'bind = "127.0.0.1:8000"\n' in fp_lines:
replace_index = fp_lines.index('bind = "127.0.0.1:8000"\n') replace_index = fp_lines.index('bind = "127.0.0.1:8000"\n')
replace_line = 'bind = "0.0.0.0:8000"\n' replace_line = 'bind = "0.0.0.0:8000"\n'
fp_lines[replace_index] = replace_line fp_lines[replace_index] = replace_line
@ -80,7 +81,7 @@ def main():
try: try:
call('{} start'.format(get_script('seafile.sh'))) call('{} start'.format(get_script('seafile.sh')))
call('{} start'.format(get_script('seahub.sh'))) #call('{} start'.format(get_script('seahub.sh')))
finally: finally:
if exists(password_file): if exists(password_file):
os.unlink(password_file) os.unlink(password_file)