MISP/misp-docker

Fetch Mapped Host Port From .env Config File

C0d3rZ3r0 opened this issue · 2 comments

While testing, I can put all my config in .env, but I must modify the docker-compose.yml file to modify the host port mappings to alternate ports 8080/8443 from misp-core's 80/443. This means that I loose these changes every time I pull updates.

I recommend changing the port mappings in a way that preserves default values in case the port variable in .env is not set.
Assuming we have .env variables called HTTP_PORT and HTTPS_PORT, the port mappings for misp-core might look as follows:

ports:
      - "{HTTP_PORT:-80}:80"
      - "{HTTPS_PORT:-443}:443"

I've not tested this and I feel too lazy busy to submit a PR. Sorry about that.

Similarly, we should add empty defaults to all docker-compose.yml variables that are optional, so that these don't throw the "... variable is not set. Defaulting to a blank string." warning each time you do a docker compose up.

Empty defaults used to not work with docker-compose, but that seems to have been fixed long back. Refer docker/compose#5829.

I don't understand, can't you just maintain a local version of the docker-compose.yml file?
This is what I do for my deployments.

Updating the local version is a few more steps when something does change upstream. Perhaps I do not know enough git.
Moreover, .env will anyways be maintained. Maintaining another instance of docker-compose.yml just for customizing ports seems a bit much for a test environment.

If you feel this is not necessary right now, we can close this issue. There's a lot of other important issues here from what I can see.
I see this as a minor change that will be beneficial, especially to testers and newbies.