@@ -80,7 +80,7 @@ public function __construct($configDir, $fileName = 'config.php') {
8080 * @return array an array of key names
8181 */
8282 public function getKeys () {
83- return array_keys ($ this ->cache );
83+ return array_merge ( array_keys ($ this ->cache ), array_keys ( $ this -> envCache ) );
8484 }
8585
8686 /**
@@ -95,9 +95,8 @@ public function getKeys() {
9595 * @return mixed the value or $default
9696 */
9797 public function getValue ($ key , $ default = null ) {
98- $ envKey = self ::ENV_PREFIX . $ key ;
99- if (isset ($ this ->envCache [$ envKey ])) {
100- return $ this ->envCache [$ envKey ];
98+ if (isset ($ this ->envCache [$ key ])) {
99+ return $ this ->envCache [$ key ];
101100 }
102101
103102 if (isset ($ this ->cache [$ key ])) {
@@ -257,7 +256,16 @@ private function readData() {
257256 }
258257 }
259258
260- $ this ->envCache = getenv ();
259+ // grab any "NC_" environment variables
260+ $ envRaw = getenv ();
261+ // only save environment variables prefixed with "NC_" in the cache
262+ $ envPrefixLen = strlen (self ::ENV_PREFIX );
263+ foreach ($ envRaw as $ rawEnvKey => $ rawEnvValue ) {
264+ if (str_starts_with ($ rawEnvKey , self ::ENV_PREFIX )) {
265+ $ realKey = substr ($ rawEnvKey , $ envPrefixLen );
266+ $ this ->envCache [$ realKey ] = $ rawEnvValue ;
267+ }
268+ }
261269 }
262270
263271 /**
0 commit comments