[GH-ISSUE #488] Support Environment Variable Overrides for Config File Settings #3418

Closed
opened 2026-04-20 07:22:10 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @veerendra2 on GitHub (Apr 8, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/488

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 GitHub (Apr 8, 2025). Original GitHub issue: https://github.com/fosrl/pangolin/issues/488 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
GiteaMirror added the enhancement label 2026-04-20 07:22:10 -05:00
Author
Owner

@oschwartz10612 commented on GitHub (Apr 8, 2025):

Ahh yeah it still wants to see the users section but overrides it. You could add the users section back to the config file and it should still pull it from the env.

We will look at making it so you do not need to have the users section at all.

<!-- gh-comment-id:2786830024 --> @oschwartz10612 commented on GitHub (Apr 8, 2025): Ahh yeah it still wants to see the users section but overrides it. You could add the users section back to the config file and it should still pull it from the env. We will look at making it so you do not need to have the users section at all.
Author
Owner

@miloschwartz commented on GitHub (Apr 11, 2025):

Yeah to Owen's point you can just put gibberish in the config for the password and it will be overridden. I think we could support more overrides in the future. If you need/want specific overrides, please open a separate feature request in the discussions section. I am going to close this issue for now.

<!-- gh-comment-id:2795645620 --> @miloschwartz commented on GitHub (Apr 11, 2025): Yeah to Owen's point you can just put gibberish in the config for the password and it will be overridden. I think we could support more overrides in the future. If you need/want specific overrides, please open a separate feature request in the discussions section. I am going to close this issue for now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#3418