views:

26

answers:

1

Hi,

I am using Zend_Oauth_Consumer which requires a number of config values to be passed. Currently i am passing an array into the constructor like so:

    $config = array(
        'callbackUrl' => 'http://www.domain.com/twitter/callback',
        'siteUrl' => 'http://twitter.com/oauth',
        'consumerKey' => 'XXXXXXXXXXXXXXXXXX',
        'consumerSecret' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
        );
    $consumer = new Zend_Oauth_Consumer($config);

I dont like this approach as these configs are now within the controller and i would like them to be in application.ini like all my other configuration values - how would i go about this? is there a naming convention to follow for example?

+4  A: 

In your application.ini you can do this:

oauth_consumer.callbackUrl = "http://www.domain.com/twitter/callback"
oauth_consumer.siteUrl = "http://twitter.com/oauth"
oauth_consumer.consumerKey = "XXXXXXXXXXXXXXXXXX"
oauth_consumer.consumerSecret = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"

And in your controller:

$config = $this->getInvokeArg('bootstrap')->getOption('oauth_consumer');
$consumer = new Zend_Oauth_Consumer($config);
reko_t
perfect, thanks reko_t
seengee