EnvConfig.php 639 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?php

namespace Aegir\Provision\Console;

/**
 * Class EnvConfig
 * @package Aegir\Provision\Console
 */
class EnvConfig extends ProvisionConfig
{
    protected $source_name = 'Environment Variable';
    
    /**
     * EnvConfig constructor.
     */
    public function __construct()
    {
        parent::__construct();
        
        // Add all of the environment vars that match our constant.
        foreach ([$_SERVER, $_ENV] as $super) {
            foreach ($super as $key => $val) {
                if ($this->keyIsConstant($key)) {
                    $this->set($key, $val);
                }
            }
        }
    }
}