Improved variable handling with a .env file

This commit is contained in:
Bento Silveira 2023-07-23 11:55:06 -03:00 committed by Nerdeiro da Silva
parent 8e0413b126
commit be894a4e8f
No known key found for this signature in database
GPG key ID: E50EFBA12C1ED3CD
2 changed files with 52 additions and 6 deletions

46
configuration.env Normal file
View file

@ -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"

View file

@ -7,8 +7,8 @@ services:
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- piped-backend - piped-backend
environment: env_file:
- BACKEND_HOSTNAME=backend-host.example.com - configuration.env
volumes: volumes:
- ./entrypoint.d/host_replace.envsh:/docker-entrypoint.d/99-host_replace.envsh - ./entrypoint.d/host_replace.envsh:/docker-entrypoint.d/99-host_replace.envsh
piped-proxy: piped-proxy:
@ -23,10 +23,8 @@ services:
image: 1337kavin/piped:latest image: 1337kavin/piped:latest
container_name: piped-backend container_name: piped-backend
restart: unless-stopped restart: unless-stopped
environment: env_file:
- FRONTEND_URL=https://frontend-host.example.com - configuration.env
- API_URL=https://backend-host.example.com
- PROXY_PART=https://proxy-host.example.com
volumes: volumes:
- ./config/config.properties:/app/config.properties:ro - ./config/config.properties:/app/config.properties:ro
depends_on: depends_on:
@ -60,6 +58,8 @@ services:
volumes: volumes:
- ./data/db:/var/lib/postgresql/data - ./data/db:/var/lib/postgresql/data
environment: environment:
# Database settings. Make sure to adjust these values
# on the configuration.env file too.
- POSTGRES_DB=piped - POSTGRES_DB=piped
- POSTGRES_USER=piped - POSTGRES_USER=piped
- POSTGRES_PASSWORD=changeme - POSTGRES_PASSWORD=changeme