gentics / mesh-incubator

Project which is home for planned enhancements for Gentics Mesh
3 stars 0 forks source link

[ENV] Make it possible to override all settings with environment variables #28

Open netwarex opened 5 years ago

netwarex commented 5 years ago

Gentics Mesh Version, operating system, or hardware.

Operating System

JVM

Problem

Some Mesh settings can be overridden by environment variables, but not all of them, which can be useful in many scenarios (eg.: in Docker environment).

Reproducer

https://getmesh.io/docs/administration-guide/#_environment_variables

Expected behaviour and actual behaviour

I would recommend to use an enviroment variable pattern to override all settings keys, and use an exception for list for settings which should not be overridden (so these environment variables can be discarded).

Example:

mesh.yml:

[...]
httpServer:
  port: 8080
  host: "0.0.0.0"
  corsAllowedOriginPattern: ""
  corsAllowCredentials: false
  enableCors: false
  ssl: false
  certPath: "config/cert.pem"
  keyPath: "config/key.pem"
cluster:
  enabled: false
  vertxPort: 0
storage:
  directory: "data/graphdb"
  backupDirectory: "data/backup"
  exportDirectory: "data/export"
[...]

Environment variable pattern (prefixed with MESH and seperated with underscores (_) on uppercased settings levels):

MESH_LEVEL1_LEVEL2=VALUE
MESH_HTTPSERVER_PORT=8000
MESH_CLUSTER_ENABLED=FALSE
MESH_STORAGE_DIRECTORY="data/graphdb"
Jotschi commented 5 years ago

Which setting can't be configured via env?

netwarex commented 5 years ago

@Jotschi eg.: oauth/keycloak settings. but generally, it could be a good addition to be able to override settings or a local configuration also can be a good alternative, like mesh.local.yml

Jotschi commented 5 years ago

Docker deployments should use the compose override file to introduce custom env settings which should be used locally. I don't recommend to use yml files when using a docker setup.