mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-30 18:00:56 +01:00
refactor: cleanup code
This commit is contained in:
6
docker/bin/docker-init.sh
Normal file
6
docker/bin/docker-init.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# replace default api path to new one
|
||||
python /app/bin/update_docker_js_api_address.py
|
||||
|
||||
crawlab-server server
|
||||
4
docker/bin/gen-ver.sh
Normal file
4
docker/bin/gen-ver.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
COMMIT_HASH=$(git rev-parse HEAD)
|
||||
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
||||
echo "v0.0.0-$TIMESTAMP-$COMMIT_HASH"
|
||||
24
docker/bin/update_docker_js_api_address.py
Normal file
24
docker/bin/update_docker_js_api_address.py
Normal 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}')
|
||||
Reference in New Issue
Block a user