ui - Dockerfile fixes and missing get_config function

This commit is contained in:
bunkerity 2021-05-31 21:06:05 +02:00
parent 2db967ad1d
commit 82e47f147d
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
6 changed files with 24 additions and 17 deletions

View File

@ -5,7 +5,7 @@ class Config :
def __init__(self) :
with open("/opt/settings.json", "r") as f :
self.__settings = json.loads(f.read())
def __env_to_dict(self, filename) :
with open(filename, "r") as f :
env = f.read()
@ -36,6 +36,13 @@ class Config :
if stderr != "" or proc.returncode != 0 :
raise Exception("Error from generator (return code = " + str(proc.returncode) + ") : " + stderr)
def get_config(self) :
config = self.__env_to_dict("/etc/nginx/global.env")
for service in self.get_services() :
for k, v in service.items() :
config[service["FIRST_SERVER"] + "_" + k] = v
return config
def get_settings(self) :
return self.__settings
@ -60,7 +67,7 @@ class Config :
check = True
if not check :
raise Exception("Variable " + k + " is not valid.")
def new_service(self, variables) :
global_env = self.__env_to_dict("/etc/nginx/global.env")
services = self.get_services()
@ -88,4 +95,4 @@ class Config :
if not found :
raise Exception("Can't delete missing " + server_name + " configuration.")
self.__gen_conf(global_env, new_services)

View File

@ -16,8 +16,8 @@ COPY settings.json /opt
COPY ui/prepare.sh /tmp
RUN chmod +x /tmp/prepare.sh && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
EXPOSE 5000

View File

@ -15,9 +15,9 @@ COPY ui/ /opt/entrypoint
COPY settings.json /opt
COPY ui/prepare.sh /tmp
RUN chmod +x /tmp/prepare && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
RUN chmod +x /tmp/prepare.sh && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
EXPOSE 5000

View File

@ -21,9 +21,9 @@ COPY ui/ /opt/entrypoint
COPY settings.json /opt
COPY ui/prepare.sh /tmp
RUN chmod +x /tmp/prepare && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
RUN chmod +x /tmp/prepare.sh && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
EXPOSE 5000

View File

@ -21,9 +21,9 @@ COPY ui/ /opt/entrypoint
COPY settings.json /opt
COPY ui/prepare.sh /tmp
RUN chmod +x /tmp/prepare && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
RUN chmod +x /tmp/prepare.sh && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
EXPOSE 5000

View File

@ -15,9 +15,9 @@ COPY ui/ /opt/entrypoint
COPY settings.json /opt
COPY ui/prepare.sh /tmp
RUN chmod +x /tmp/prepare && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
RUN chmod +x /tmp/prepare.sh && \
/tmp/prepare.sh && \
rm -f /tmp/prepare.sh
EXPOSE 5000