From 7abfa58484a0f755d5215b7d47f7ce9e91a8892d Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:11:54 -0300 Subject: [PATCH 1/7] Update Docker Compose to change Pastebin port and adjust volume mapping --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 48fe8ab..4dba46f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,12 +4,10 @@ services: pastebin: image: mkaczanowski/pastebin:latest container_name: pastebin - volumes: - - $DOCKERDIR/pastebin:/var/lib/pastebin restart: unless-stopped command: --address 0.0.0.0 --port 8081 --uri ${URI} --db=/var/lib/pastebin/ ports: - - "8081:8081" + - "8000:8081" volumes: - ./db:/var/lib/pastebin/ From e8d8f48ae2ea47b98334981a0deb6a6e02c49089 Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:17:28 -0300 Subject: [PATCH 2/7] Update Docker Compose to set Pastebin URI to localhost --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4dba46f..e3f3c4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: mkaczanowski/pastebin:latest container_name: pastebin restart: unless-stopped - command: --address 0.0.0.0 --port 8081 --uri ${URI} --db=/var/lib/pastebin/ + command: --address 0.0.0.0 --port 8081 --uri http://localhost --db=/var/lib/pastebin/ ports: - "8000:8081" volumes: From 41cc97be1e2ef9e55f29d11ddb296f63d9bb5bca Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:19:31 -0300 Subject: [PATCH 3/7] Update Docker Compose to use environment variable for Pastebin URI --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e3f3c4a..4dba46f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: mkaczanowski/pastebin:latest container_name: pastebin restart: unless-stopped - command: --address 0.0.0.0 --port 8081 --uri http://localhost --db=/var/lib/pastebin/ + command: --address 0.0.0.0 --port 8081 --uri ${URI} --db=/var/lib/pastebin/ ports: - "8000:8081" volumes: From 9215fc9b5afd686697f8bc0aa13aa531dac416ef Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:23:05 -0300 Subject: [PATCH 4/7] Remove version specification from Docker Compose file --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4dba46f..b905492 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.7" - services: pastebin: image: mkaczanowski/pastebin:latest From 7f2d6db58663013a05fbf639e662afeb744385ee Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:29:21 -0300 Subject: [PATCH 5/7] Add URI prefix from environment variable in custom.js --- static/custom.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/custom.js b/static/custom.js index 4e2cb3b..7415bd8 100644 --- a/static/custom.js +++ b/static/custom.js @@ -1,4 +1,6 @@ $(document).ready(function() { + const uri_prefix = process.env.URI; + function replaceUrlParam(url, param, value) { if (value == null) { value = ''; From 14555c56e60511d8ef6ae430d6a0144fb46ac136 Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:33:01 -0300 Subject: [PATCH 6/7] Add .env file to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 78e97eb..d2e4820 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ Cargo.lock **/*.rs.bk pastebin.db + +.env \ No newline at end of file From b6913d36cf332f7e1c3b6a8776da7061a295148d Mon Sep 17 00:00:00 2001 From: Rodrigo-Flores Date: Sat, 4 Jan 2025 02:33:07 -0300 Subject: [PATCH 7/7] Add .env file support in Docker Compose and set default URI prefix in custom.js --- docker-compose.yml | 2 ++ static/custom.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b905492..324e836 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,8 @@ services: - "8000:8081" volumes: - ./db:/var/lib/pastebin/ + env_file: + - .env nginx: image: "nginx" diff --git a/static/custom.js b/static/custom.js index 7415bd8..ab33725 100644 --- a/static/custom.js +++ b/static/custom.js @@ -1,5 +1,5 @@ $(document).ready(function() { - const uri_prefix = process.env.URI; + const uri_prefix = process.env.URI || ""; function replaceUrlParam(url, param, value) { if (value == null) {