Grafana configuration
Grafana configuration#
Grafana configuration with env vars#
Grafana can be configured with a grafana.ini file that would contain something like this :
[auth.generic_auth]
enabled=true
...
We can also use environment variables to override those values, which is a way to configure Grafana. Above configuration becomes :
GF_AUTH_GENERIC_OAUTH_ENABLED: true
Grafana also have some magic : when the name of the environment var ends with __FILE suffix, Grafana will consider that the value of the env var is a file and the real value to use is the contents of that file.
For example instead of GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET='some secret', we can use GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET__FILE=/etc/secrets/keycloak-client-secret.
Configuration environment variables are defined in default values when possible. Specific values are the URL of the keycloak API and the Grafana public URL.