File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/Joomlatools/Console/Command Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,22 @@ protected function _getConfigOverride($name)
4242 {
4343 $ file = sprintf ('%s/.joomlatools/console/config.yaml ' , trim (`echo ~ `));
4444
45- if (file_exists ($ file )) {
46- $ this ->_config = Yaml::parseFile ($ file );
45+ if (file_exists ($ file ))
46+ {
47+ $ file_contents = \file_get_contents ($ file );
48+ $ env = $ _ENV ;
49+
50+ // Replace longest keys first
51+ uksort ($ env , function ($ a , $ b ){
52+ return strlen ($ b ) - strlen ($ a );
53+ });
54+
55+ // Replace environment variables in the file
56+ foreach ($ env as $ key => $ value ) {
57+ $ file_contents = \str_replace ('$ ' .$ key , $ value , $ file_contents );
58+ }
59+
60+ $ this ->_config = Yaml::parse ($ file_contents );
4761 } else {
4862 $ this ->_config = false ;
4963 }
You can’t perform that action at this time.
0 commit comments