Icinga / docker-icinga2

Official Icinga 2 Docker images
GNU General Public License v2.0
66 stars 30 forks source link

Generate config from environment and templates #77

Closed t3easy closed 2 years ago

t3easy commented 2 years ago

As Icinga 2 config can be very complex, I think it would be better to generate config from templates and environment variables like the official nginx image does, instead of writing hole config files in environment variables like in the Icinga Web 2 Image.

https://github.com/nginxinc/docker-nginx/blob/1.21.6/entrypoint/20-envsubst-on-templates.sh

Templates must be stored outside of the data volume, as they could change on every start of the container.

julianbrost commented 2 years ago

You can use getenv() in the config, so you should actually already be able to do this: https://icinga.com/docs/icinga-2/latest/doc/18-library-reference/#getenv

t3easy commented 2 years ago

You can use getenv() in the config, so you should actually already be able to do this: https://icinga.com/docs/icinga-2/latest/doc/18-library-reference/#getenv

Good point! I have configured ido-mysql and other feature like this now and it works perfectly.