wemake-services / caddy-gen

Automated Caddy reverse proxy for docker containers
https://hub.docker.com/r/wemakeservices/caddy-gen
MIT License
251 stars 25 forks source link

Automatic detection of localhost #63

Closed bedax closed 2 years ago

bedax commented 2 years ago

Hello, I have a docker-compose.yml file which I want to be largely static, such that a user wouldn't need to edit it. I then have a .env file where the user can add their specific details, like their email address.

So let's say .env contains:

DOMAIN=localhost
EMAIL=bob@somewhere.com

And the docker-compose.yml contains:

services:
  service:
    labels:
      virtual.tls: $EMAIL
      virtual.host: $DOMAIN
      virtual.port: 80

I currently get the following error:

Obtain: subject does not qualify for a public certificate: localhost

So I have to set EMAIL=internal for it to work. Unless I'm missing something (which is possible; I'm new to docker), it would be nice if it could be detected that given the virtual.host is localhost, virtual.tls must be internal.