updating addon-variables for existing apps

36 views
Skip to first unread message

Michael Hunger

unread,
Nov 2, 2011, 9:04:09 PM11/2/11
to heroku-add-...@googlegroups.com, Thomas Baum
Hi,

I would like to know if it is possible to later update the environment variables an app gets set when the addon is provisioned.

We would like to enable transfer of services to other machines and right now we have to transparently map hostnames via DNS and have to share ports over a range of servers to enable that feature. We would like to be able to simply update a users addon-variables.

Thanks a lot

Michael Hunger

Morten Bagai

unread,
Nov 2, 2011, 9:58:47 PM11/2/11
to heroku-add-...@googlegroups.com, heroku-add-...@googlegroups.com, Thomas Baum
Yes, there's a callback URL that's passed to you in the provisioning call. You can post a new config hash to it.

Best,

-Morten

Sent from my iPad

Michael Hunger

unread,
Nov 3, 2011, 2:19:55 PM11/3/11
to heroku-add-...@googlegroups.com, kowsik, Morten Bagai, Thomas Baum
Sorry if you get this email twice,
Thomas was not invited to the google group so it got bounced.

Thanks for any pointers on the format for POSTing to the callback URL.

Michael

Am 03.11.2011 um 15:40 schrieb thoma...@atns.de:

> hi morten & kowsik,
>
> thank you for the answer, but can you get a bit more specific please:
>
> the callback_url i get from
>
> ## curl https://neo4j:$PA...@api.heroku.com/vendor/apps/36a30e299
> {"callback_url":"https://api.heroku.com/vendor/apps/app632672%40heroku.com","owner_email":"thoma...@atns.de","name":"furious-fog-653","domains":["furious-fog-653.heroku.com"],"id":"app6...@heroku.com","config":{"NEO4J_REST_URL":"http://3225308b5:3bee...@server1.hosted.neo4j.org:7004/db/data","NEO4J_URL":"http://3225308b5:3bee...@server1.hosted.neo4j.org:7004","NEO4J_PASSWORD":"3bee2abb8","NEO4J_LOGIN":"3225308b5","NEO4J_HOST":"server1.hosted.neo4j.org","NEO4J_PORT":"7004","NEO4J_INSTANCE":"36a30e299"}}
>
>
> what should i post back?
>
> ## curl -XPOST -d '{"callback_url":"https://api.heroku.com/vendor/apps/app632672%40heroku.com","owner_email":"thoma...@atns.de","name":"furious-fog-653","domains":["furious-fog-653.heroku.com"],"id":"app6...@heroku.com","config":{"NEO4J_REST_URL":"http://3225308b5:3bee...@server1.hosted.neo4j.org:7004/db/data","NEO4J_URL":"http://3225308b5:3bee...@server1.hosted.neo4j.org:7004","NEO4J_PASSWORD":"3bee2abb8","NEO4J_LOGIN":"3225308b5","NEO4J_HOST":"server1.hosted.neo4j.org","NEO4J_PORT":"7004","NEO4J_INSTANCE":"36a30e299"}}' https://neo4j:$PA...@api.heroku.com/vendor/apps/36a30e299
> ... gives a
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> ....
> <h2>Page Not Found</h2>
> <p class="panel-body">Sorry champ, no luck at that URL. Cut-and-paste error, maybe?</p>
> ....
> </html>
>
>
>
> thanks!
>
> thomas
>
>
>
> Am 03.11.2011 um 03:20 schrieb kowsik:
>
>> You can use the callback_url to POST new configs whenever you want.
>> This will update the config vars and also restart the apps that have
>> your addons.
>>
>> K.
>> ---
>> http://blitz.io
>> @pcapr

Pat Allan

unread,
Nov 3, 2011, 2:25:57 PM11/3/11
to heroku-add-...@googlegroups.com
Here's a quick example, using HTTParty's put method:

put uri,
:body => JSON.dump(:config => config),
:basic_auth => authentication

uri is the callback_url for the given app/client, config is a hash of env vars and values, and authentication is a hash of :username and :password with your add-on's username and password.

--
Pat

Michael Hunger

unread,
Nov 7, 2011, 6:29:10 PM11/7/11
to heroku-add-...@googlegroups.com
Morten,

is it safe to store the information that is returned by the heroku-api callbacks?

Or which part is immutable for the lifetime of an application and can be safely stored?

Thanks

Michael

Morten Bagai

unread,
Nov 7, 2011, 6:45:22 PM11/7/11
to heroku-add-...@googlegroups.com
Yes, should be.

-M

kowsik

unread,
Nov 2, 2011, 10:20:04 PM11/2/11
to heroku-add-...@googlegroups.com, Thomas Baum
You can use the callback_url to POST new configs whenever you want.
This will update the config vars and also restart the apps that have
your addons.

K.
---
http://blitz.io
@pcapr

Reply all
Reply to author
Forward
0 new messages