Problem with consumer web application in Ruby on 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 Welc开发者_Python百科omeController < 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.
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
abort "env URL is not set" unless ENV.has_key? 'MYADDON_URL'
精彩评论