fix(docker): api address incorrect issue

This commit is contained in:
Marvin Zhang
2022-12-21 17:39:22 +08:00
parent ec8960dd6f
commit b46a8a2b9d
3 changed files with 27 additions and 43 deletions

View File

@@ -0,0 +1,24 @@
import os
dir_path = '/app/dist/assets'
for file_name in os.listdir(dir_path):
if not file_name.endswith('.js'):
continue
file_path = os.path.join(dir_path, file_name)
api_url = 'http://localhost:8000'
with open(file_path, 'r') as f:
content = f.read()
if api_url not in content:
continue
content = content.replace(api_url, '/api')
with open(file_path, 'w') as f:
f.write(content)
print(f'replaced api url in file: {file_name}')