From be894a4e8f4bd1896297606b0461f595874af579 Mon Sep 17 00:00:00 2001 From: Bento Silveira Date: Sun, 23 Jul 2023 11:55:06 -0300 Subject: [PATCH] Improved variable handling with a .env file --- configuration.env | 46 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 12 ++++++------ 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 configuration.env diff --git a/configuration.env b/configuration.env new file mode 100644 index 0000000..6b3e415 --- /dev/null +++ b/configuration.env @@ -0,0 +1,46 @@ +########################### +# Hostname settings # +########################### + +BACKEND_HOSTNAME=backend-host.example.com +FRONTEND_HOSTNAME=frontend-host.example.com +PROXY_HOSTNAME=proxy-host.example.com + +########################### +# API container settings # +########################### + +# Port the server will listen on. +PORT=8080 + +# The number of workers to use for the server +HTTP_WORKERS=2 + +# URLs for the services. These need to be configured +# on your DNS service +FRONTEND_URL=https://frontend-host.example.com +API_URL=https://backend-host.example.com +PROXY_PART=https://proxy-host.example.com + +# Outgoing HTTP Proxy - eg: 127.0.0.1:8118 +#HTTP_PROXY=127.0.0.1:8118 + +# Captcha Parameters +CAPTCHA_BASE_URL=https://api.capmonster.cloud/ +CAPTCHA_API_KEY=INSERT_HERE + +# Enable haveibeenpwned compromised password API +COMPROMISED_PASSWORD_CHECK=true + +# Disable Registration +DISABLE_REGISTRATION=false + +# Feed Retention Time in Days +FEED_RETENTION=30 + +# Database settings +hibernate.connection.url="jdbc:postgresql://postgres:5432/piped" +hibernate.connection.driver_class="org.postgresql.Driver" +hibernate.dialect="org.hibernate.dialect.PostgreSQLDialect" +hibernate.connection.username="piped" +hibernate.connection.password="changeme" diff --git a/docker-compose.yml b/docker-compose.yml index bfb8234..be87ddb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: restart: unless-stopped depends_on: - piped-backend - environment: - - BACKEND_HOSTNAME=backend-host.example.com + env_file: + - configuration.env volumes: - ./entrypoint.d/host_replace.envsh:/docker-entrypoint.d/99-host_replace.envsh piped-proxy: @@ -23,10 +23,8 @@ services: image: 1337kavin/piped:latest container_name: piped-backend restart: unless-stopped - environment: - - FRONTEND_URL=https://frontend-host.example.com - - API_URL=https://backend-host.example.com - - PROXY_PART=https://proxy-host.example.com + env_file: + - configuration.env volumes: - ./config/config.properties:/app/config.properties:ro depends_on: @@ -60,6 +58,8 @@ services: volumes: - ./data/db:/var/lib/postgresql/data environment: + # Database settings. Make sure to adjust these values + # on the configuration.env file too. - POSTGRES_DB=piped - POSTGRES_USER=piped - POSTGRES_PASSWORD=changeme