I''m just wondering what the best way to go about loading my API keys from the database is ... Should I simply place them in the ENV variable? Is there a way better way to go about this?
You''ll probably have to modify the plugin, at least Facebooker::Session since right now the API key is loaded once at plugin initialization, and if you''re running more than 1 app, you''ll need to signal some way to indicate which keys to load. One way to do this is to check for parameters in Application.rb with a before_filter and set a new variable in the Facebooker::Session class. Keep us updated on your progress, this would be a great contribution. On Wed, Apr 2, 2008 at 8:23 PM, Toby Hede <tobyhede at info-architects.net> wrote:> I''m just wondering what the best way to go about loading my API keys > from the database is ... > > Should I simply place them in the ENV variable? > > Is there a way better way to go about this? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >
At the moment I just have a before_filter in my controller:
ENV[''FACEBOOK_API_KEY''] = @app.api_key
ENV[''FACEBOOK_SECRET_KEY''] = @app.secret_key
Which seems to be working fine.
On Thu, Apr 3, 2008 at 1:47 PM, Jonathan Otto <jonathan.otto at gmail.com>
wrote:> You''ll probably have to modify the plugin, at least
> Facebooker::Session since right now the API key is loaded once at
> plugin initialization, and if you''re running more than 1 app,
you''ll
> need to signal some way to indicate which keys to load.
>
> One way to do this is to check for parameters in Application.rb with a
> before_filter and set a new variable in the Facebooker::Session class.
>
> Keep us updated on your progress, this would be a great contribution.
>
>
>
> On Wed, Apr 2, 2008 at 8:23 PM, Toby Hede <tobyhede at
info-architects.net> wrote:
> > I''m just wondering what the best way to go about loading my
API keys
> > from the database is ...
> >
> > Should I simply place them in the ENV variable?
> >
> > Is there a way better way to go about this?
> > _______________________________________________
> > Facebooker-talk mailing list
> > Facebooker-talk at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/facebooker-talk
> >
>
Are you trying to support multiple applications from a single application? I''m not a big fan of using Environment variables for this. In my local copy, I have methods on the Facebooker module, so that you can call Facebooker.api_key and Facebooker.secret_key. This seems a little cleaner to me. That would allow you to override those methods to pull them from the DB or do anything else. Mike On Apr 2, 2008, at 11:19 PM, Toby Hede wrote:> At the moment I just have a before_filter in my controller: > > ENV[''FACEBOOK_API_KEY''] = @app.api_key > ENV[''FACEBOOK_SECRET_KEY''] = @app.secret_key > > Which seems to be working fine. > > > > On Thu, Apr 3, 2008 at 1:47 PM, Jonathan Otto > <jonathan.otto at gmail.com> wrote: >> You''ll probably have to modify the plugin, at least >> Facebooker::Session since right now the API key is loaded once at >> plugin initialization, and if you''re running more than 1 app, you''ll >> need to signal some way to indicate which keys to load. >> >> One way to do this is to check for parameters in Application.rb >> with a >> before_filter and set a new variable in the Facebooker::Session >> class. >> >> Keep us updated on your progress, this would be a great contribution. >> >> >> >> On Wed, Apr 2, 2008 at 8:23 PM, Toby Hede <tobyhede at info-architects.net >> > wrote: >>> I''m just wondering what the best way to go about loading my API keys >>> from the database is ... >>> >>> Should I simply place them in the ENV variable? >>> >>> Is there a way better way to go about this? >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>> >> > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com