mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Moved up .env docs in changelog
They're needed much earlier
This commit is contained in:
parent
ff0b648d75
commit
862fcec553
@ -187,6 +187,72 @@ For a full list of renamed classes, check the `.upgrade.yml` definitions in each
|
|||||||
|
|
||||||
The rename won't affect class-based permission codes or database table names.
|
The rename won't affect class-based permission codes or database table names.
|
||||||
|
|
||||||
|
### <a name="env"></a>`_ss_environment.php` changed to`.env`
|
||||||
|
|
||||||
|
The php configuration `_ss_environment.php` file has been replaced in favour of a non-executable
|
||||||
|
`.env` file, which follows a syntax similar to an `.ini` file for key/value pair assignment. Like
|
||||||
|
the old php file, `.env` may be placed in either the web root, or one level above.
|
||||||
|
|
||||||
|
For example, if you have the below `_ss_environment.php` file, your `.env` would be rewritten as follows:
|
||||||
|
|
||||||
|
`_ss_environment.php`:
|
||||||
|
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Environment
|
||||||
|
define('SS_ENVIRONMENT_TYPE', 'dev');
|
||||||
|
define('SS_DEFAULT_ADMIN_USERNAME', 'admin');
|
||||||
|
define('SS_DEFAULT_ADMIN_PASSWORD', 'password');
|
||||||
|
$_FILE_TO_URL_MAPPING[__DIR__] = 'http://localhost';
|
||||||
|
|
||||||
|
// Database
|
||||||
|
define('SS_DATABASE_CHOOSE_NAME', true);
|
||||||
|
define('SS_DATABASE_CLASS', 'MySQLDatabase');
|
||||||
|
define('SS_DATABASE_USERNAME', 'root');
|
||||||
|
define('SS_DATABASE_PASSWORD', '');
|
||||||
|
define('SS_DATABASE_SERVER', '127.0.0.1');
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
`.env`:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
## Environment
|
||||||
|
SS_ENVIRONMENT_TYPE="dev"
|
||||||
|
SS_DEFAULT_ADMIN_USERNAME="admin"
|
||||||
|
SS_DEFAULT_ADMIN_PASSWORD="password"
|
||||||
|
SS_BASE_URL="http://localhost/"
|
||||||
|
|
||||||
|
### Database
|
||||||
|
SS_DATABASE_CHOOSE_NAME="true"
|
||||||
|
SS_DATABASE_CLASS="MySQLDatabase"
|
||||||
|
SS_DATABASE_USERNAME="root"
|
||||||
|
SS_DATABASE_PASSWORD=""
|
||||||
|
SS_DATABASE_SERVER="127.0.0.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
The removal of the `_ss_environment.php` file means that conditional logic is no longer available in the environment
|
||||||
|
variable set-up process. This generally encouraged bad practice and should be avoided. If you still require conditional
|
||||||
|
logic early in the bootstrap, this is best placed in the `_config.php` files.
|
||||||
|
|
||||||
|
Note also that `$_FILE_TO_URL_MAPPING` has been removed and replaced with `SS_BASE_URL` env var.
|
||||||
|
This url must be an absolute url with an optional protocol. The following are valid, for example:
|
||||||
|
|
||||||
|
```
|
||||||
|
SS_BASE_URL="http://localhost/"
|
||||||
|
SS_BASE_URL="https://localhost/"
|
||||||
|
SS_BASE_URL="//localhost/"
|
||||||
|
```
|
||||||
|
|
||||||
|
The global values `$database` and `$databaseConfig` have been deprecated, as has `ConfigureFromEnv.php`
|
||||||
|
which is no longer necessary.
|
||||||
|
|
||||||
|
To access environment variables you can use the `SilverStripe\Core\Environment::getEnv()` method.
|
||||||
|
|
||||||
|
See [Environment Management docs](/getting-started/environment_management/) for full details.
|
||||||
|
|
||||||
### Get upgrade tips on your code
|
### Get upgrade tips on your code
|
||||||
|
|
||||||
While there's some code we can automatically rewrite, other uses of changed SilverStripe APIs aren't that obvious.
|
While there's some code we can automatically rewrite, other uses of changed SilverStripe APIs aren't that obvious.
|
||||||
@ -474,72 +540,6 @@ SilverStripe\Core\Manifest\ModuleManifest:
|
|||||||
project: mysite
|
project: mysite
|
||||||
```
|
```
|
||||||
|
|
||||||
### <a name="env"></a>`_ss_environment.php` changed to`.env`
|
|
||||||
|
|
||||||
The php configuration `_ss_environment.php` file has been replaced in favour of a non-executable
|
|
||||||
`.env` file, which follows a syntax similar to an `.ini` file for key/value pair assignment. Like
|
|
||||||
the old php file, `.env` may be placed in either the web root, or one level above.
|
|
||||||
|
|
||||||
For example, if you have the below `_ss_environment.php` file, your `.env` would be rewritten as follows:
|
|
||||||
|
|
||||||
`_ss_environment.php`:
|
|
||||||
|
|
||||||
|
|
||||||
```php
|
|
||||||
// Environment
|
|
||||||
define('SS_ENVIRONMENT_TYPE', 'dev');
|
|
||||||
define('SS_DEFAULT_ADMIN_USERNAME', 'admin');
|
|
||||||
define('SS_DEFAULT_ADMIN_PASSWORD', 'password');
|
|
||||||
$_FILE_TO_URL_MAPPING[__DIR__] = 'http://localhost';
|
|
||||||
|
|
||||||
// Database
|
|
||||||
define('SS_DATABASE_CHOOSE_NAME', true);
|
|
||||||
define('SS_DATABASE_CLASS', 'MySQLDatabase');
|
|
||||||
define('SS_DATABASE_USERNAME', 'root');
|
|
||||||
define('SS_DATABASE_PASSWORD', '');
|
|
||||||
define('SS_DATABASE_SERVER', '127.0.0.1');
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
`.env`:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
## Environment
|
|
||||||
SS_ENVIRONMENT_TYPE="dev"
|
|
||||||
SS_DEFAULT_ADMIN_USERNAME="admin"
|
|
||||||
SS_DEFAULT_ADMIN_PASSWORD="password"
|
|
||||||
SS_BASE_URL="http://localhost/"
|
|
||||||
|
|
||||||
### Database
|
|
||||||
SS_DATABASE_CHOOSE_NAME="true"
|
|
||||||
SS_DATABASE_CLASS="MySQLDatabase"
|
|
||||||
SS_DATABASE_USERNAME="root"
|
|
||||||
SS_DATABASE_PASSWORD=""
|
|
||||||
SS_DATABASE_SERVER="127.0.0.1"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
The removal of the `_ss_environment.php` file means that conditional logic is no longer available in the environment
|
|
||||||
variable set-up process. This generally encouraged bad practice and should be avoided. If you still require conditional
|
|
||||||
logic early in the bootstrap, this is best placed in the `_config.php` files.
|
|
||||||
|
|
||||||
Note also that `$_FILE_TO_URL_MAPPING` has been removed and replaced with `SS_BASE_URL` env var.
|
|
||||||
This url must be an absolute url with an optional protocol. The following are valid, for example:
|
|
||||||
|
|
||||||
```
|
|
||||||
SS_BASE_URL="http://localhost/"
|
|
||||||
SS_BASE_URL="https://localhost/"
|
|
||||||
SS_BASE_URL="//localhost/"
|
|
||||||
```
|
|
||||||
|
|
||||||
The global values `$database` and `$databaseConfig` have been deprecated, as has `ConfigureFromEnv.php`
|
|
||||||
which is no longer necessary.
|
|
||||||
|
|
||||||
To access environment variables you can use the `SilverStripe\Core\Environment::getEnv()` method.
|
|
||||||
|
|
||||||
See [Environment Management docs](/getting-started/environment_management/) for full details.
|
|
||||||
|
|
||||||
### <a name="object-replace"></a>Object class replaced by traits
|
### <a name="object-replace"></a>Object class replaced by traits
|
||||||
|
|
||||||
Object has been superseded by traits.
|
Object has been superseded by traits.
|
||||||
|
Loading…
Reference in New Issue
Block a user