Skip to content

Commit

Permalink
Registering enviromental variables in a more generic loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Apr 2, 2012
1 parent 886174b commit 37f9756
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,16 @@
define('TEMPLATES', $_SERVER['DOCUMENT_ROOT'] . WEB_FOLDER . 'templates/');

// Process enviromental variables (from env.json)
foreach( $env as $domain => $setup ){
foreach( $env as $domain => $properties ){
// check the domain against each set
if( strpos($_SERVER['SERVER_NAME'], $domain) !== false ){
// available options: base, plugins, cdn, debug
// - include a BASE constant here if this is a clone site
if( !empty($setup->base) ) eval("define('BASE', '$setup->base');");
// - you can set the location of your plugins - by default a subdir in the app folder
if( !empty($setup->plugins) ) eval("define('PLUGINS', '$setup->plugins');");
if( !empty($setup->cdn) ) eval("define('CDN', '$setup->cdn');");
if( !empty($setup->debug) ) eval("define('DEBUG', '$setup->debug');");
// available options: base, plugins, cdn, debug (sdk)
foreach( $properties as $key=>$value ){
if( !empty($value) ) eval("define('".strtoupper($key)."', '$value');");
}
// exit if we found a match
break;
}
var_dump(DEBUG);

}
}

// Other Constants
Expand Down

0 comments on commit 37f9756

Please sign in to comment.