How can I read out the parameters in config/main.php

Hello,

I’m currently working on a monitoring controller, that checks the health of the application.

One aspect is checking the config-parameters of the db-connection.

So I need to read out the connectionString and compare it aganinst another string to check, whether the parameter is correct or not.

I tried, for debugging:




print_r(Yii::app()->db->connectionString);



If the connectionString is working, it just dumps a string with the value.

BUT, if I change that value to something that isn’t working, it tries to open a connection, what is failing, and then ist throws an exception.

But I just want to get the (wrong) connectionString, nothing more.

The same is happening, when I trie to check our SOLR-Component-Settings etc.

It looks like it is first doing something with the given value, and if that "something" fails, it throws an exception before dumping the pure value.

So what is the right way to read out the configparameters from config/main.php

Thanks!

R.

I got it (hopefully):




		$config = Yii::app()->getComponents(false);

		print_r($config[db][connectionString]);