Heroku 上 Ruby 中的消费者 Web 应用程序出现问题
我开发了一个简单的 Ruby“Hello World”应用程序。
现在我想使用我在heroku平台上托管的附加组件(附加组件是简单的其余WCF服务,如获取和发布),addon-menifest.json
文件看起来像下面
{
"id": "Myaddon",
"api": {
"config_vars": [ "MYADDON_URL" ],
"password": "mypass",
"sso_salt": "oKWSWM2Nj7X0uX90",
"production": "https://yourapp.com/",
"test": "http://localhost/RestWCFDemo/RestServiceImpl.svc"
}
}
我在 Ruby 应用程序根目录中添加了这个文件,并在 app/controllers
中创建了 welcome_controller.rb
(将索引设置为 route.rb 中的起点)文件,其中包含以下代码
class WelcomeController < ActionController::Base
protect_from_forgery
def index
abort "env URL is not set" unless ENV.has_key? 'MYADDON_URL'
end
end
和最终输出我总是得到 env URL is not set 作为例外。我想通过heroku的第二部分构建消费者来测试heroku插件
任何人都可以帮我理清heroku的这一过程吗?
谢谢 阿伦.
I developed a simple Ruby "Hello World" application.
Now i would like to consume add-on which i have hosted on heroku platform (add-on is simple rest WCF service, like get & post), addon-menifest.json
file looks like as per below
{
"id": "Myaddon",
"api": {
"config_vars": [ "MYADDON_URL" ],
"password": "mypass",
"sso_salt": "oKWSWM2Nj7X0uX90",
"production": "https://yourapp.com/",
"test": "http://localhost/RestWCFDemo/RestServiceImpl.svc"
}
}
I added this file in my Ruby application root and in app/controllers
I created welcome_controller.rb
(set index as starting point in route.rb ) file which contain following code
class WelcomeController < ActionController::Base
protect_from_forgery
def index
abort "env URL is not set" unless ENV.has_key? 'MYADDON_URL'
end
end
And final output I always get env URL is not set as a exception. I want to pass this 2nd part of heroku Build Consumer to test heroku addon
Can any one help me to sort out this process of heroku??
Thanks
Arun.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的应用程序需要提供配置接口。请遵循配置文档。
您需要创建一个控制器,并且该控制器必须响应至少 2 个操作:配置和取消配置。当用户尝试启用插件时,Heroku 将向您的配置操作发送 POST 请求,并期望您的应用程序创建必要的配置和帐户,并返回用户详细信息。
同样,当用户删除插件时,Heroku 会调用您的取消配置 URI 并期望它删除用户帐户。
请参阅 API 参考。
Your application needs to offer a provisioning interface. Follow the provisioning documentation.
You need to create a controller and this controller must respond to at least 2 actions: provision and deprovision. When an user tries to enable the addon, Heroku will send a POST request to your provision action and expects your application to create the necessary configurations and accounts, and returns the user details.
Likewise, when the user deletes the addon, Heroku calls your deprovision URI and expects it to remove the user account.
See the API reference.
环境变量区分大小写。你的代码不应该是
The environment variables are case-sensitive. Shouldn't your code be