Support Environment Variable Overrides for Config File Settings #1630

Closed
opened 2026-04-05 19:37:59 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @veerendra2 on 4/8/2025

Allow environment variables to override values defined in the configuration file. This enables more flexible deployment and easier integration with CI/CD pipelines or containerized environments.

Background

Use Case

  • In general, I don't prefer to store credentials in a config file, and prefer pass as environmental variables/docker secrets
  • In my case, I'm trying to following GitOps way, where keep in the config in "docker config" like below
---
configs:
  config.yml:
    name: config.yml
    content: |
      app:
          dashboard_url: "https://${MY_DOMAIN:?error}"
          log_level: "info"
          save_logs: true
          log_failed_attempts: true
...

and in my docker compose file


---
include:
  - compose.config.yml

networks:
  default:
    driver: bridge
    name: pangolin

volumes:
  traefik_acme:
    name: traefik_acme
  gerbil_data:
    name: gerbil_data

services:
  pangolin:
    image: fosrl/pangolin:latest
    container_name: pangolin
    hostname: pangolin
    restart: unless-stopped
    environment:
      USERS_SERVERADMIN_EMAIL: ${USERS_SERVERADMIN_EMAIL:?error}
      USERS_SERVERADMIN_PASSWORD: ${USERS_SERVERADMIN_PASSWORD:?error}
    configs:
      - source: config.yml
        target: /app/config/config.yml
        mode: "0444"
...

When I try like this, I get error

/app/server/lib/config.ts:215
            throw new Error(`Invalid configuration file: ${errors}`);
                  ^


Error: Invalid configuration file: Validation error: Required at "users"
    at Config.loadConfig (/app/server/lib/config.ts:215:19)
    at new Config (/app/server/lib/config.ts:173:14)
    at <anonymous> (/app/server/lib/config.ts:364:23)

Node.js v20.19.0

It is looking for users section in config file

*Originally created by @veerendra2 on 4/8/2025* Allow environment variables to override values defined in the configuration file. This enables more flexible deployment and easier integration with CI/CD pipelines or containerized environments. ## Background - Installation method I try to use: [Docker Compose](https://docs.fossorial.io/Getting%20Started/Manual%20Install%20Guides/docker-compose) - Version: 1.2.0 ## Use Case - In general, I don't prefer to store credentials in a config file, and prefer pass as environmental variables/docker secrets - In my case, I'm trying to following GitOps way, where keep in the config in "docker config" like below ```yaml --- configs: config.yml: name: config.yml content: | app: dashboard_url: "https://${MY_DOMAIN:?error}" log_level: "info" save_logs: true log_failed_attempts: true ... ``` and in my docker compose file ```yaml --- include: - compose.config.yml networks: default: driver: bridge name: pangolin volumes: traefik_acme: name: traefik_acme gerbil_data: name: gerbil_data services: pangolin: image: fosrl/pangolin:latest container_name: pangolin hostname: pangolin restart: unless-stopped environment: USERS_SERVERADMIN_EMAIL: ${USERS_SERVERADMIN_EMAIL:?error} USERS_SERVERADMIN_PASSWORD: ${USERS_SERVERADMIN_PASSWORD:?error} configs: - source: config.yml target: /app/config/config.yml mode: "0444" ... ``` When I try like this, I get error ```bash /app/server/lib/config.ts:215 throw new Error(`Invalid configuration file: ${errors}`); ^ Error: Invalid configuration file: Validation error: Required at "users" at Config.loadConfig (/app/server/lib/config.ts:215:19) at new Config (/app/server/lib/config.ts:173:14) at <anonymous> (/app/server/lib/config.ts:364:23) Node.js v20.19.0 ``` It is looking for `users` section in config file
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#1630