Is it possible to load multiple `--envfile`?

1. The problem I’m having:

I have a bunch of apps set up with compose.yaml and I’ve separated the ports and host/domain they need into their respective .env files and was hoping I’d be able to load it as variables into my Caddyfile at the root.
I’ll probably end up using systemd unit files which do let me add multiple EnvironmentFile directives, but since these values don’t change between needing to update my whole deployment, I was hoping there was a simpler option that would just get compiled in at Caddyfile-parse-time.
I probably just need to script it, but thought I’d ask.

c. Service/unit/compose file:

# Compose example setting domains and ports from env file
version: '3.6'
services:
  gitlab:
    image: gitlab/gitlab-ce:latest-ce.0
    hostname: '${GITLAB_DOMAIN}'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://${GITLAB_DOMAIN}'
    ports:
      - '${GITLAB_HTTP_PORT}:80'

d. My complete Caddy config:

{$GITLAB_DOMAIN} {
	reverse_proxy localhost:{$GITLAB_HTTP_PORT}:
}
# OR
git.dev.home {
	reverse_proxy localhost:8000
}

grist.dev.home {
	reverse_proxy localhost:9000
}

Not currently, no. But we could probably support that, I don’t see why not. PRs open if you want to take a shot at implementing it.

1 Like