wizzy icon indicating copy to clipboard operation
wizzy copied to clipboard

[Feature] Support configuration with environment variables

Open forzagreen opened this issue 4 years ago • 4 comments

It would be nice if wizzy can load json files containing environment variables. This is useful for conf/wizzy.json and datasources. The conf/wizzy.json file would look like:

{
  "config": {
    "grafana": {
      "url": "https://mygrafana.example.com",
      "username": "${ADMIN_USERNAME}",
      "password": "${ADMIN_PASSWORD}"
    }
  }
}

Example of a datasource datasources/my-influxdb.json:

{
  "orgId": 1,
  "name": "my-influxdb",
  "type": "influxdb",
  "url": "http://localhost:8086",
  "user": "${DB_USER}",
  "password": "${DB_PASSWORD}",
  "database": "${DB_NAME}"
}

It can achieved e.g. with Mustache.js.

FYI, Grafana support using environment variables in its config file: cf. https://grafana.com/docs/installation/configuration/#using-environment-variables

forzagreen avatar Aug 06 '19 16:08 forzagreen

I also agree with this idea, I have some dashboards that could use variables before export.

Sytten avatar Aug 06 '19 16:08 Sytten

I thought of that too. It would be really nice. Actually I'm asking if integrating an entire templating engine wouldn't be nice. Having thinks like conditions loops and support for environment variables would be really nice.

johnsudaar avatar Aug 06 '19 20:08 johnsudaar

I think that i'll try to PoC adding a templating engine to the current js files.

Edit: The PoC is available at #148

johnsudaar avatar Aug 06 '19 20:08 johnsudaar

Postponed to 0.8.0

Sytten avatar Aug 25 '19 17:08 Sytten