Skip to content

Changes the value of site variables (and potentially other things) based on $_SERVER['HTTP_HOST'] or $_SERVER['pantheon_environment']

Notifications You must be signed in to change notification settings

fga/pantheon_envconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

PURPOSE
-------

UCB Environment Configurations (ucb_envconf) is a small module that
defines configuration depending on the environment (dev/test/live) of
the site. When developing a Drupal site in a dev/test/live environment
the developer will often load her dev site with the live database.
(Consider the Pantheon dashboard funtion "Sync content and pull
code.")  Unless the developer manually updates certain settings, the
dev site will receive some settings that should be specific to
production.

ucb_envconf automatically forces certain settings to their correct
values based on the site's environment. It does this via hook_boot().
The module takes pains to do as little as possible in hook_boot so as
not to negatively affect site performance.

Basically: 

if ($site_env == 'live') {
  $conf['cas_server'] = 'auth.berkeley.edu';
} 
elseif ($site_env == 'dev') OR ($site_env == 'test') {
  $conf['cas_server'] = 'auth-test.berkeley.edu';
}

There are a number of different ways that this goal might be achieved:

1. Insert conditional logic into settings.php
2. Use a module like this one
3. Write a Rule triggered by cron

We chose #2 because

- We can limit user confusion by doing form_alters explaining about
  hard-coded variables which don't change when admin forms are
  submitted.

- Users can easily disable the module if they don't like the
  functionality. They don't have to go edit code in settings.php. They
  don't have to disable rules.

BRANCHES
--------

See the github branches for the actual code.

About

Changes the value of site variables (and potentially other things) based on $_SERVER['HTTP_HOST'] or $_SERVER['pantheon_environment']

Resources

Stars

Watchers

Forks

Packages

No packages published