arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 593 forks source link

Environment variables for plugins #630

Closed kishuagarwal closed 5 years ago

kishuagarwal commented 6 years ago

I am writing a new plugin for integrating with InfluxDB. From what I gather from the source code, only the CABOT_PLUGINS_ENABLED is get from the environment and the values for the inbuilt plugins like graphite, jenkins and so on. I want to use more environment variables for InfluxDB like INFLUXDB_API, USER, but I am not able to figure out on how to best to do it.

Any help would be highly appreciated.

thomasleveil commented 5 years ago

Your plugin code can simply read the environment variable with os.environ.get('MY_VAR')

dbuxton commented 5 years ago

For example https://github.com/cabotapp/cabot-alert-slack/blob/a547ce46ec00b6a57946ce78b78c763d37e9243b/cabot_alert_slack/models.py#L68 @kishuagarwal