[development] How implement global variables that varydepending on the server (i.e. production, test, demo) within Drupal?

Daniel F. Kudwien news at unleashedmind.com
Thu Mar 17 22:44:20 UTC 2011


Use this instead:

/**
 * Load local development override configuration, if existent.
 */
if (file_exists(dirname(__FILE__) . '/settings.local.php')) {
  include dirname(__FILE__) . '/settings.local.php';
}

And make sure it's at the very end of settings.php.

sun 

> -----Original Message-----
> From: development-bounces at drupal.org 
> [mailto:development-bounces at drupal.org] On Behalf Of Dylan Wilder-Tack
> Sent: Thursday, March 17, 2011 11:08 PM
> To: development at drupal.org
> Subject: Re: [development] How implement global variables 
> that varydepending on the server (i.e. production, test, 
> demo) within Drupal?
> 
> I create a second config file, local_settings.php. Then I 
> configure it to override anything in the main settings file 
> by adding this to settings.php:
> 
> if (file_exists('./'. conf_path() .'/local_settings.php')) {
>   include_once './'. conf_path() .'/local_settings.php'; } 
> settings.php is placed in version control, and 
> local_settings.php is not. Upon deployment, the local 
> settings file is then symlinked to a shared directory in each 
> server.  In my case the symlink is created by the 
> :after_update_code task in capistrano, but you could manage 
> this local config file any way you want.
> 
> If the cap stuff sounds interesting, there's code on my blog: 
> http://metaltoad.com/132
> 
> 
> On Mar 17, 2011, at 10:40 AM, John Mitchell wrote:
> 
> > For java webapps within Apache Tomcat I use a web.xml file 
> which contains the global variables that are specific to that 
> server so that the production server will have one web.xml 
> file and the test server will have a different web.xml file.
> > 
> > How can I do something similar for global variables that 
> vary depending on the server (i.e. production, test, demo) 
> within Drupal?
> > 
> > Thanks,
> > 
> > John
> 



More information about the development mailing list