Skip to content

Commit

Permalink
Allow list of servers to be set from environment
Browse files Browse the repository at this point in the history
If BEANSTALK_SERVERS is set in the environment, explode on commas and
add the resultant elements to the list of servers
Also, avoid a PHP undefined variable warning when there are no groups
setup by setting $groups before including templates
  • Loading branch information
thwarted committed Aug 13, 2014
1 parent d8b1c93 commit 6a21a0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/include.php
Expand Up @@ -202,6 +202,11 @@ protected function __init() {
}

$this->servers = $config['servers'];
if (isset($_ENV['BEANSTALK_SERVERS'])) {
foreach (explode(",", $_ENV["BEANSTALK_SERVERS"]) as $server) {
$this->servers[] = $server;
}
}
if (isset($_COOKIE['beansServers'])) {
foreach (explode(';', $_COOKIE['beansServers']) as $server) {
$this->servers[] = $server;
Expand Down
1 change: 1 addition & 0 deletions public/index.php
Expand Up @@ -10,6 +10,7 @@
require_once '../lib/include.php';
$console = new Console;
$errors = $console->getErrors();
$groups = array();
$tplVars = $console->getTplVars();
extract($tplVars);
?>
Expand Down

0 comments on commit 6a21a0e

Please sign in to comment.