NEW Add .env support

This commit is contained in:
Daniel Hensby 2017-01-30 17:19:55 +00:00
parent a4d886e9d4
commit 06b475896d
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
4 changed files with 13 additions and 2 deletions

9
.env.example Normal file
View File

@ -0,0 +1,9 @@
# For a complete list of core environment variables see
# https://docs.silverstripe.org/en/4/getting_started/environment_management/#core-environment-variables
# DB credentials
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_SERVER="localhost"
SS_DATABASE_USERNAME="<user>"
SS_DATABASE_PASSWORD="<password>"
SS_DATABASE_NAME="<database>"

4
.gitignore vendored
View File

@ -1,8 +1,8 @@
# ignore cache folder # ignore cache folder
/silverstripe-cache/ /silverstripe-cache/
# ignore all environment files # ignore .env file
_ss_environment.php /.env
# ignore build tools # ignore build tools
/tools/phing-metadata /tools/phing-metadata

View File

@ -44,6 +44,7 @@ ErrorDocument 500 /assets/error-500.html
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Deny access to potentially sensitive files and folders # Deny access to potentially sensitive files and folders
RewriteRule ^\.env - [F,L,NC]
RewriteRule ^vendor(/|$) - [F,L,NC] RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC] RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC] RewriteRule composer\.(json|lock) - [F,L,NC]

View File

@ -4,6 +4,7 @@
<security> <security>
<requestFiltering> <requestFiltering>
<hiddenSegments> <hiddenSegments>
<add segment=".env" />
<add segment="silverstripe-cache" /> <add segment="silverstripe-cache" />
<add segment="vendor" /> <add segment="vendor" />
<add segment="composer.json" /> <add segment="composer.json" />