NginxProxyManager / NginxProxyManager/nginx-proxy-manager
Standardize environment variables for database connection
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34.2k
- Forks
- 3.9k
- Avg merge
- 21h 12m
- Merged PRs (30d)
- 20
Description
Is your feature request related to a problem? Please describe.
Currently, there are multiple environment variables for each type of database connection. So if several environment variables are passed, for example from Postgres and MySQL/MariaDB, which one will actually be used as the connection?
Describe the solution you'd like
This should be easier when specifying the database engine, configuring fewer environment variables, and knowing where they will be set based on the DB_ENGINE environment variable.
Replace the environment variables and unify them as follows:
DB_MYSQL_HOSTandDB_POSTGRES_HOST, withDB_HOST.DB_MYSQL_PORTandDB_POSTGRES_PORT, withDB_HOST.DB_MYSQL_USERandDB_POSTGRES_USERwithDB_USER.DB_MYSQL_PASSWORDandDB_POSTGRES_PASSWORDwithDB_PASSWORD.DB_MYSQL_NAMEandDB_POSTGRES_NAMEwithDB_NAME.
Describe alternatives you've considered
MySQL/MariaDB stack:
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format <host-port>:<container-port>
- '80:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
environment:
# MySQL/MariaDB connection parameters:
DB_ENGINE: 'mysql'
DB_HOST: "db"
DB_PORT: 3306
DB_NAME: "npm"
DB_USER: "npm"
DB_PASSWORD: "npm"
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
MARIADB_AUTO_UPGRADE: '1'
volumes:
- ./mysql:/var/lib/mysql
Postgres stack:
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format <host-port>:<container-port>
- '80:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
environment:
# PostgreSQL parameters:
DB_ENGINE: 'postgres'
DB_HOST: 'db'
DB_PORT: '5432'
DB_NAME: 'npm'
DB_USER: 'npm'
DB_PASSWORD: 'npmpass'
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db
db:
image: postgres:latest
environment:
POSTGRES_USER: 'npm'
POSTGRES_PASSWORD: 'npmpass'
POSTGRES_DB: 'npm'
volumes:
- ./postgres:/var/lib/postgresql/data
Additional context
The same could work for other SQL databases such as Firebird, Microsoft SQL Server, Oracle, or Amazon Relational Database Service.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for existing DB_MYSQL_* and DB_POSTGRES_* handling and the DB_ENGINE entry point; compare the MySQL/MariaDB and PostgreSQL configuration paths shown in the issue. Done means DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, and DB_NAME are selected consistently by DB_ENGINE, with both database configurations covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose, mariadb, mysql, postgresql, typescript
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100