Hubot-从文件加载环境变量 [英] Hubot - load environmental variables from a file

查看:109
本文介绍了Hubot-从文件加载环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生产服务器上为Hubot设置环境变量非常容易.但是,当我想在本地测试Bot时,我需要在文件中包含env vars.我已经有了heroku用于本地运行的env vars的文件.env.

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.

但是我似乎找不到从文件中的Hubot脚本中加载env vars的方法.

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

圣诞快乐:-)

推荐答案

好吧,可以使用hubot-env.

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].

以前它对我不起作用,因为我在Mac上设置了HUBOT_ENV_BASE_PATH,因此该命令在错误的文件夹中搜索了该文件.

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.

这篇关于Hubot-从文件加载环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆