Automate loading .env when Hubot starts
Regarding this issue as I understood Hubot doesn't read .env file. Instead of exporting variables each time my solution was to create bash-script run.sh
file:
#!/bin/bashexport HUBOT_OWM_APIKEY=MY_OWM_API_KEY;export HUBOT_WEATHER_UNITS=metric;HUBOT_SLACK_TOKEN=xoxb-xxxx-MY_SLACK_TOKEN ./bin/hubot --adapter slack
then in bash
$ chmod +x run.sh # provides the permissions$ ./run.sh # starts the bot with necessary variables
This is a really old question but I'm working on Hubot now and need to save this for posterity.
This is how I'm doing it now. It works without adding additional files or packages:
"scripts": { "start": "export $(cat .env | xargs) && ./bin/hubot -a slack" }
Change your adapter from slack
to whatever you are using.