Sublime Text 2 - `Mandrill ::错误:您必须提供Mandrill API密钥

时间:2022-01-28 18:17:38

I am using Sublime Text 2 as my editor for rails applications and have an rspec test suite which passed without issue until I added email functionality using the Mandrill API.

我使用Sublime Text 2作为我的rails应用程序的编辑器,并且在我使用Mandrill API添加电子邮件功能之前,有一个没有问题的rspec测试套件。

Wherever I now attempt to send an email I receive the following error:

无论我现在尝试发送电子邮件,都会收到以下错误:

Mandrill::Error:
       You must provide a Mandrill API key

If I run these tests within the terminal, they pass.

如果我在终端内运行这些测试,它们就会通过。

The API key is set as an environment variable within my .bash_profile.

API密钥在我的.bash_profile中设置为环境变量。

Is there a way to configure Sublime Text to use these variables?

有没有办法配置Sublime Text来使用这些变量?

2 个解决方案

#1


0  

try this out:

试试这个:

I think you are looking for how to set environment variables in sublime text?

我想你正在寻找如何在sublime文本中设置环境变量?

so there is a solution already on *.

所以*上已有一个解决方案。

sublime text how to set environment variable

sublime text如何设置环境变量

#2


0  

The Sublime Text architecture is quite nice and allows you to implement your own plugin easily.

Sublime Text架构非常好,可以让您轻松实现自己的插件。

They are automatically loaded when Sublime Text starts. Thus you can write your own custom plugin that sets these variables in the Sublime text env:

Sublime Text启动时会自动加载它们。因此,您可以编写自己的自定义插件,在Sublime文本环境中设置这些变量:

# ~/Library/Application Support/Sublime Text 3/Packages/User/your_plugin.py
import os

os.environ['MANDRIL_API_PUBLIC'] = 'xxxxx'
os.environ['MANDRIL_API_PRIVATE'] = 'xxxxx'

Have a look here for more informations.

看看这里有更多的信息。

#1


0  

try this out:

试试这个:

I think you are looking for how to set environment variables in sublime text?

我想你正在寻找如何在sublime文本中设置环境变量?

so there is a solution already on *.

所以*上已有一个解决方案。

sublime text how to set environment variable

sublime text如何设置环境变量

#2


0  

The Sublime Text architecture is quite nice and allows you to implement your own plugin easily.

Sublime Text架构非常好,可以让您轻松实现自己的插件。

They are automatically loaded when Sublime Text starts. Thus you can write your own custom plugin that sets these variables in the Sublime text env:

Sublime Text启动时会自动加载它们。因此,您可以编写自己的自定义插件,在Sublime文本环境中设置这些变量:

# ~/Library/Application Support/Sublime Text 3/Packages/User/your_plugin.py
import os

os.environ['MANDRIL_API_PUBLIC'] = 'xxxxx'
os.environ['MANDRIL_API_PRIVATE'] = 'xxxxx'

Have a look here for more informations.

看看这里有更多的信息。