Browse Source

Add link prefix as parameter

pull/1322/head
Johann Frei 3 years ago
parent
commit
b46777bbbb
2 changed files with 4 additions and 2 deletions
  1. 2
      offline_deployment/offline_02_2-import_Docker_images.sh
  2. 4
      offline_deployment/offline_patcher.py

2
offline_deployment/offline_02_2-import_Docker_images.sh

@ -11,7 +11,7 @@ sed -i 's^dockerfile: nginx/Dockerfile^dockerfile: nginx/Dockerfile\n image:
# Modify Dockerfile for nginx to add python3 and offline patch
sed -i 's|FROM nginx|COPY offline_deployment/offline_patcher.py /patch.py\
RUN apk add -U --no-cache py3-requests \\\
\&\& mkdir -p /app/dist/static/offline \&\& python3 /patch.py /app/dist /app/dist/static/offline\
\&\& mkdir -p /app/dist/static/offline \&\& python3 /patch.py /app/dist /app/dist/static/offline /offline\
\
FROM nginx|' ../nginx/Dockerfile

4
offline_deployment/offline_patcher.py

@ -8,10 +8,12 @@ def main():
root_folder = sys.argv[1]
# offline folder to store static offline files
offline_folder = sys.argv[2]
# offline link prefix
offline_prefix = sys.argv[3]
offline_file = os.path.join(offline_folder, "offline_{}.{}")
offline_link = "offline/offline_{}.{}"
offline_link = offline_prefix + "/offline_{}.{}"
mime_ptn = re.compile(r"(?P<mime>(?P<t1>[\w^\/]+)\/(?P<t2>[\S\.^\;]+))(\;|$)", re.IGNORECASE)
#link_ptn = re.compile(r"(?P<encl>[\S\"\'])(?P<link>https?:\/\/(?P<host>[\S^:\/)]+)(?P<port>\:[0-9]+)?\/((?!(?P=encl)).)+)(?P=encl)", re.IGNORECASE)

Loading…
Cancel
Save