| Conditions | 5 |
| Paths | 5 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 3 | public function getEnvVarsFromConsul(array $mappings) |
|
| 44 | { |
||
| 45 | 3 | foreach ($mappings as $envKey => $kvPath) { |
|
| 46 | 3 | $keyExists = (false === getenv($envKey)) ? false : true; |
|
| 47 | 3 | if ($keyExists && !$this->overwriteEvenIfDefined) { |
|
| 48 | 1 | continue; |
|
| 49 | } |
||
| 50 | |||
| 51 | 2 | $kvValue = $this->kv->get($kvPath)->getBody(); |
|
| 52 | 2 | putenv("{$envKey}={$kvValue}"); |
|
| 53 | } |
||
| 54 | 3 | } |
|
| 55 | } |
||
| 56 |