Hubot - load environmental variables from a file

2019-05-20 23:21发布

问题:

setting environmental variables for a Hubot is pretty easy on the production server. However when I want to test the bot locally, I need the env vars inside a file. I already have the file .env for env vars that heroku is using for running locally.

But I can't seem to find a way to load env vars inside the Hubot scripts from a file.

Merry Christmas :-)

回答1:

okay it's possible with hubot-env.

https://www.npmjs.com/package/hubot-env

The following command will load the file from a relative path:

hubot env load --filename=[filename].

It previously didn't work for me because I had HUBOT_ENV_BASE_PATH set on my mac so the command searched in the wrong folder for the file.