From 11f88ab13c8b602ee643574ce845a175a1d102f0 Mon Sep 17 00:00:00 2001 From: William Bell Date: Thu, 3 Aug 2023 19:31:41 +0200 Subject: [PATCH] add environment variables --- .dockerignore | 3 ++- .gitignore | 3 ++- config.ar | 10 ++++++++-- docker-compose.yml | 7 ++++++- server.ar | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7766392..55890e7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ argon_modules -data \ No newline at end of file +data +.env \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9b03b0f..eac5d68 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ __isotope__ argon_modules # main -data \ No newline at end of file +data +.env \ No newline at end of file diff --git a/config.ar b/config.ar index 49a8d9d..116ad55 100644 --- a/config.ar +++ b/config.ar @@ -1,2 +1,8 @@ -let url = "http://isotope.wbell.dev" -let domain = "isotope.wbell.dev" \ No newline at end of file +let url = env.get("URL","https://isotope.wbell.dev") +term.log("URL: "+url) +let domain = env.get("domain","isotope.wbell.dev") +term.log("domain: "+domain) +let port = number(env.get("PORT", 8080)) +term.log("port: "+port) + +term.log(env) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 84ec4f7..cb3a31b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,4 +6,9 @@ services: ports: - '7030:7030' volumes: - - './data:/isotope-server/data' \ No newline at end of file + - './data:/isotope-server/data' + environment: + - URL=https://isotope.wbell.dev + - domain=isotope.wbell.dev + - PORT=7031 + restart: unless-stopped \ No newline at end of file diff --git a/server.ar b/server.ar index f612c4c..d163b7a 100644 --- a/server.ar +++ b/server.ar @@ -1,4 +1,5 @@ import "http.ar" as http +import "config" as config let app = http.server() @@ -6,4 +7,4 @@ app.use(http.logger) app.use(http.cookie) app.use(http.formdata) app.use(http.static("/","static")) -app.port = 7030 \ No newline at end of file +app.port = config.port \ No newline at end of file