codescope
(Deepbluegene)
May 3, 2012, 1:30am
1
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
Y11
(Y!!)
May 3, 2012, 1:56am
2
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);
codescope
(Deepbluegene)
May 3, 2012, 3:28am
3
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.