works
This commit is contained in:
1 parent
722e499089
commit
a915a87ed9
4 files changed
+3
-30
No files matched your search
@@ -36,36 +36,9 @@ def read_file(path):
|
||||
return None
|
||||
|
||||
|
||||
def read_env_file(path):
|
||||
"""Parse a KEY=value env file (optionally quoted) into a dict."""
|
||||
env = {}
|
||||
try:
|
||||
with open(path) as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
if line.startswith("export "):
|
||||
line = line[len("export ") :].strip()
|
||||
key, value = line.split("=", 1)
|
||||
value = value.strip()
|
||||
if len(value) >= 2 and value[0] == value[-1] and value[0] in "\"'":
|
||||
value = value[1:-1]
|
||||
env[key.strip()] = value
|
||||
except (FileNotFoundError, PermissionError):
|
||||
pass
|
||||
return env
|
||||
|
||||
|
||||
def main():
|
||||
audit = {}
|
||||
|
||||
# Provider / contract info (API_KEY is intentionally not exposed)
|
||||
server_env = read_env_file("/etc/4server")
|
||||
audit["PROVIDER"] = server_env.get("PROVIDER")
|
||||
audit["CONTRACT_END"] = server_env.get("CONTRACT_END")
|
||||
audit["COST"] = server_env.get("COST")
|
||||
|
||||
# Container identity
|
||||
audit["container_id"] = os.environ.get("HOSTNAME")
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
# Get the hostname of the machine
|
||||
HOSTNAME=$(hostname)
|
||||
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') START N8N UUID=${UUID} HOST=${HOSTNAME} DOMAIN=${UUID}.odoo4projects.com DOMAIN2=${UUID}.${HOSTNAME}.odoo4projects.com"
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') START N8N UUID=${UUID} HOST=${HOSTNAME} DOMAIN=${UUID}.odoo4projects.com"
|
||||
|
||||
mkdir -p /4server/data/${UUID}/n8n
|
||||
mkdir -p /4server/data/${UUID}/data
|
||||
@@ -53,7 +53,7 @@ docker run -d \
|
||||
-v "/4server/data/${UUID}/data:/data" \
|
||||
-v "/4server/data/${UUID}/backup:/backup" \
|
||||
--label "traefik.enable=true" \
|
||||
--label "traefik.http.routers.${UUID}.rule=Host(\`${UUID}.odoo4projects.com\`) || Host(\`${UUID}.${HOSTNAME}.odoo4projects.com\`)" \
|
||||
--label "traefik.http.routers.${UUID}.rule=Host(\`${UUID}.odoo4projects.com\`)" \
|
||||
--label "traefik.http.routers.${UUID}.entrypoints=web,websecure" \
|
||||
--label "traefik.http.routers.${UUID}.tls=true" \
|
||||
--label "traefik.http.routers.${UUID}.tls.certresolver=production" \
|
||||
|
||||
Reference in new issue
Block a user