-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add environment configuration section (#357)
- Loading branch information
1 parent
ec58344
commit 61a58ed
Showing
10 changed files
with
291 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Documentation/Installation/Environments/_additional-context.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
use TYPO3\CMS\Core\Core\Environment; | ||
|
||
defined('TYPO3') or die(); | ||
|
||
$context = Environment::getContext(); | ||
$baseDirectory = Environment::getConfigPath(); | ||
$subContexts = explode('/', strtolower($context)); | ||
|
||
// Include a file like system/production.php, system/development.php | ||
// or system/staging.php - depending on the TYPO3_CONTEXT application | ||
// context that is currently active. | ||
if (file_exists($baseDirectory . '/system/' . $subContexts[0] . '.php')) { | ||
include $baseDirectory . '/system/' . $subContexts[0] . '.php'; | ||
} | ||
|
||
// ALSO overload an environment-specific configuration, to allow more | ||
// specific environment configuration on top of the "global" application | ||
// context. | ||
if (file_exists($baseDirectory . '/system/environment.php')) { | ||
include $baseDirectory . '/system/environment.php'; | ||
} |
5 changes: 5 additions & 0 deletions
5
Documentation/Installation/Environments/_additional-native.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
defined('TYPO3') or die(); | ||
|
||
require __DIR__ . '/environment.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
defined('TYPO3') or die(); | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] | ||
= $_ENV['TYPO3_MAIL_TRANSPORT']; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server'] | ||
= $_ENV['TYPO3_MAIL_TRANSPORT_SMTP_SERVER']; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_username'] | ||
= $_ENV['TYPO3_MAIL_TRANSPORT_SMTP_USERNAME']; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_password'] | ||
= $_ENV['TYPO3_MAIL_TRANSPORT_SMTP_PASSWORD']; | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] | ||
= $_ENV['TYPO3_DB_DBNAME']; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] | ||
= $_ENV['TYPO3_DB_HOST']; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] | ||
= $_ENV['TYPO3_DB_PASSWORD']; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] | ||
= $_ENV['TYPO3_DB_USER']; | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] = [ | ||
$_ENV['TYPO3_BE_LOCKROOTPATH'], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
use Symfony\Component\Dotenv\Dotenv; | ||
use TYPO3\CMS\Core\Core\Environment; | ||
|
||
$dotenv = new Dotenv(); | ||
$dotenv->load(Environment::getProjectPath() . '/.env'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use Dotenv\Dotenv; | ||
use TYPO3\CMS\Core\Core\Environment; | ||
|
||
defined('TYPO3') or die(); | ||
|
||
$dotenv = Dotenv::createUnsafeImmutable(Environment::getProjectPath()); | ||
$dotenv->load(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
defined('TYPO3') or die(); | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] | ||
= 'smtp'; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_server'] | ||
= 'smtp.example.com:25'; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_username'] | ||
= '[email protected]'; | ||
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_smtp_password'] | ||
= 'verySafeAndSecretPassword0815!'; | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] | ||
= 'typo3'; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] | ||
= 'db.example.com'; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] | ||
= 'verySafeAndSecretPassword0815!'; | ||
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] | ||
= 'typo3'; | ||
|
||
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] = [ | ||
'/var/www/shared/files/', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Mail settings | ||
TYPO3_MAIL_TRANSPORT="smtp" | ||
TYPO3_MAIL_TRANSPORT_SMTP_SERVER="smtp.example.com:25" | ||
TYPO3_MAIL_TRANSPORT_SMTP_USERNAME="[email protected]" | ||
TYPO3_MAIL_TRANSPORT_SMTP_PASSWORD="verySafeAndSecretPassword0815!" | ||
|
||
# Database settings | ||
TYPO3_DB_DBNAME="typo3" | ||
TYPO3_DB_HOST="db.example.com" | ||
TYPO3_DB_PASSWORD="verySafeAndSecretPassword0815!" | ||
TYPO3_DB_USER="typo3" | ||
|
||
# Rootpath for files | ||
TYPO3_BE_LOCKROOTPATH="/var/www/shared/files/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
.. index:: Production Settings; Environment | ||
|
||
.. _production-settings: | ||
|
||
Production Settings | ||
=================== | ||
|
||
To ensure a secure installation of TYPO3 on a production server, the following settings need to be set: | ||
|
||
- :guilabel:`Admin Tools > Settings > Configuration Presets` The "Live" preset has to be chosen to make sure no debug output is displayed. | ||
When using environment specific configurations, the recommended way is to specifically set the values for | ||
error/debugging configuration values instead of presets, like: | ||
|
||
.. code-block:: php | ||
:caption: config/system/additional.php | typo3conf/system/additional.php | ||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = '0'; | ||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['sqlDebug'] = '0'; | ||
$GLOBALS['TYPO3_CONF_VARS']['FE']['debug'] = '0'; | ||
$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] = '0'; | ||
These can be set for example through the :ref:`environment-configuration`. | ||
- `HTTPS` should be used on production servers and :php:`$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL']` should be set to `true`. | ||
- Enforce HSTS (Strict-Transport-Security header) in the web servers configuration. | ||
- The `TYPO3_CONTEXT` environment variable should be set to a main context of `Production` (can be verified on the top right in the TYPO3 backend :guilabel:`Application Information`). It should be used to select the appropriate `base variant` for the target system in the Site Configuration. | ||
- Configure the :ref:`TYPO3 logging framework <t3coreapi:logging-configuration>` to log messages of high severity including and above WARNING or ERROR | ||
and continue to rotate log files stored in :file:`var/log`. | ||
- Verify the :ref:`file permissions <t3coreapi:security-file-directory-permissions>` are correct on the live system. | ||
|