access config value in sitecontroller

Hi

I want to define new config value ‘server-status’=> ‘Production’ or ‘server-status’=> ‘Development’ in config/main.php

and later access them in sitecontroller to switch to diffeetn authentication server automatically depending upon the server-status.

how i can acheive that?

Thanks

You can use Yii::app()->params to store such variables.

In config:


'params' => array(

   'server-status' => 'production',

),

However, maybe it’s a better solution to define a global constant in your index.php. It has some benefits like using the constant in your config file (eg use a different db connnection in production).


define('PRODUCTION', false);

Thanks for reply. it is working now.

I used params instead of constant.