File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 22
33namespace Deployer ;
44
5+ use RuntimeException ;
56use SourceBroker \DeployerInstance \Env ;
67
78set ('default_stage ' , function () {
8- $ instance = (new Env ())->get ('INSTANCE ' );
9+ $ env = new Env ();
10+ $ env ->load ();
11+ $ instance = $ env ->get ('INSTANCE ' );
912 if ($ instance === null ) {
10- throw new \ RuntimeException (
13+ throw new RuntimeException (
1114 'INSTANCE var is no set. ' ,
1215 1602784218
1316 );
Original file line number Diff line number Diff line change 22
33namespace SourceBroker \DeployerInstance ;
44
5+ use RuntimeException ;
56use Symfony \Component \Dotenv \Dotenv ;
67
78class Env
@@ -25,7 +26,7 @@ public function load(string $configFile = null, $envKey = null): void
2526 }
2627 self ::$ envLoaded = true ;
2728 } else {
28- throw new \ RuntimeException ('Missing config file. Searching in: '
29+ throw new RuntimeException ('Missing config file. Searching in: '
2930 . "\n" . $ configFile , 1500717945887 );
3031 }
3132 }
@@ -34,13 +35,9 @@ public function load(string $configFile = null, $envKey = null): void
3435 /**
3536 * @param string $envName
3637 * @return mixed|null
37- * @throws \Exception
3838 */
3939 public function get (string $ envName )
4040 {
41- if (!self ::$ envLoaded ) {
42- $ this ->load ();
43- }
4441 return $ _ENV [$ envName ] ?? null ;
4542 }
4643}
You can’t perform that action at this time.
0 commit comments