Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
hhit
config-generator
Commits
ed373eda
Commit
ed373eda
authored
Mar 03, 2021
by
Hendrik Heneke
Browse files
Check existence of .env file.
parent
c85bb69e
Pipeline
#374
passed with stage
in 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
src/Generator/Factory.php
src/Generator/Factory.php
+6
-1
No files found.
src/Generator/Factory.php
View file @
ed373eda
...
...
@@ -81,7 +81,12 @@ class Factory
if
(
is_array
(
$env
=
@
include
$this
->
projectDir
.
'/.env.local.php'
)
&&
(
!
isset
(
$env
[
'APP_ENV'
])
||
(
$_SERVER
[
'APP_ENV'
]
??
$_ENV
[
'APP_ENV'
]
??
$env
[
'APP_ENV'
])
===
$env
[
'APP_ENV'
]))
{
(
new
Dotenv
(
false
))
->
populate
(
$env
);
}
else
{
(
new
Dotenv
(
false
))
->
loadEnv
(
$this
->
projectDir
.
'/.env'
);
$dotenvFile
=
$this
->
projectDir
.
'/.env'
;
if
(
file_exists
(
$dotenvFile
))
{
(
new
Dotenv
(
false
))
->
loadEnv
(
$dotenvFile
);
}
else
{
// TODO: log?
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment