grafana-wizzy / wizzy

Manage & automate Grafana with easy wizzy
https://grafana-wizzy.com
Apache License 2.0
470 stars 61 forks source link

[Feature] Pass configuration file in environment variable #176

Closed forzagreen closed 4 years ago

forzagreen commented 4 years ago

The configuration file is fixed as conf/wizzy.json here:

https://github.com/grafana-wizzy/wizzy/blob/5e6b09ba680c40f8f5d134976de2de524a5af6be/src/util/config.js#L8-L9

It will be very useful to have many configuration files, and to pass the configuration file to be used as an environment variable or as a parameter:

export WIZZY_CONF_FILE="conf/wizzy.json"
wizzy list dashboards

or

wizzy --conf-file "conf/wizzy.json" list dashboards
forzagreen commented 4 years ago

Well, I close since a similar solution is implemented using envs and context:

# configure 2 environments:
wizzy set grafana envs DEV url "http://grafana.mydev.com"
wizzy set grafana envs PROD url "http://grafana.myprod.com"

# list dashboards in DEV:
wizzy set context grafana DEV
wizzy list dashboards

# list dashboards in PROD:
wizzy set context grafana PROD
wizzy list dashboards

Thanks