From 1923320c8013b9d217bb8c29df1666fcaa1f199c Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 6 Dec 2020 20:59:46 +0200
Subject: [PATCH] Remove secret from the repo.

Still, it will there in the image. That's fine with me.
---
 Dockerfile                  | 6 ++++++
 conf.d/www.shore.co.il.conf | 2 +-
 docker-compose.yml          | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 0671814..cfcca9f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
 FROM nginx:1.19-alpine
+ARG TRANSMISSION
 # hadolint ignore=DL3018
 RUN rm -rf /etc/nginx/conf./* && \
     chmod 777 /run && \
@@ -24,6 +25,11 @@ RUN rm -rf /etc/nginx/conf./* && \
 COPY www/ /var/www/
 COPY conf.d/ /etc/nginx/conf.d/
 COPY snippets/ /etc/nginx/snippets/
+# Another option would be to copy the file to the template directory and have
+# the environment variable substitution happen in runtime, but that way would
+# miss checking the syntax during the build process.
+# hadolint ignore=SC2097,SC2098
+RUN TRANSMISSION=$TRANSMISSION sed -i "s/TRANSMISSION/$TRANSMISSION/" /etc/nginx/conf.d/www.shore.co.il.conf
 USER nginx
 RUN nginx -t
 HEALTHCHECK CMD curl --fail --verbose --user-agent 'Docker health check' http://localhost/ || exit 1
diff --git a/conf.d/www.shore.co.il.conf b/conf.d/www.shore.co.il.conf
index ef07233..bc9993a 100644
--- a/conf.d/www.shore.co.il.conf
+++ b/conf.d/www.shore.co.il.conf
@@ -77,7 +77,7 @@ server {
         proxy_buffering     off;
     }
 
-    location /d16ebf5287f85724083b0e20a9c300f3/ {
+    location /TRANSMISSION/ {
         proxy_pass http://kodi.shore.co.il:9091/;
         proxy_http_version 1.1;
         include             snippets/proxy-headers.conf;
diff --git a/docker-compose.yml b/docker-compose.yml
index f60cc75..046d07e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,6 +3,8 @@ version: '3.5'
 services:
   proxy:
     build:
+      args:
+        TRANSMISSION: "${TRANSMISSION}"
       context: ./
     #command: ["nginx", "-g", "daemon off;"]
     hostname: &hostname www.shore.co.il
-- 
GitLab