Skip to content

Instantly share code, notes, and snippets.

@justinrainbow
Created April 4, 2012 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinrainbow/2303648 to your computer and use it in GitHub Desktop.
Save justinrainbow/2303648 to your computer and use it in GitHub Desktop.
Dynamically changing DIC parameters based on location
<?php
$ip = trim(`/usr/sbin/arp $(hostname) | awk -F'[()]' '{print $2}'`);
if (0 === strpos($ip, '192.168.100.')) {
$container->setParameter("mongodb_servers", "mongodb://mongo-home.local");
$container->setParameter("redis_dsn_primary", "redis://redis-home.local");
} else {
$container->setParameter("mongodb_servers", "mongodb://mongo-work.local");
$container->setParameter("redis_dsn_primary", "redis://redis-work.local");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment