Add ENV to allow hiding startup message (#6348)

* Add ENV to allow hiding startup message

Signed-off-by: Peter Baričič <pbaricic@gmail.com>

* Rename ENV

Signed-off-by: Peter Baričič <peter.baricic@naytrolabs.com>

* Revert the logic

Signed-off-by: Peter Baričič <pbaricic@gmail.com>

* Update docs with startup ENVs

Signed-off-by: Peter Baričič <pbaricic@gmail.com>

Co-authored-by: Peter Baričič <peter.baricic@naytrolabs.com>
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
This commit is contained in:
Peter Baričič 2020-07-16 09:01:08 +02:00 committed by GitHub
parent eb272e996c
commit 36ab6144cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -61,6 +61,15 @@ Start a Strapi application with autoReload disabled.
This commands is there to run a Strapi application without restarts and file writes (aimed at production usage).
Certain features are disabled in the `strapi start` mode because they require application restarts.
Allowed environment variables:
| Property | Description | Type | Default |
| --------- | ----------- | ----- | ------- |
| STRAPI_HIDE_STARTUP_MESSAGE | If `true` then Strapi will not show startup message on boot. Values can be `true` or `false` | string | `false` |
| STRAPI_LOG_LEVEL | Values can be 'fatal', 'error', 'warn', 'info', 'debug', 'trace' | string | `debug` |
| STRAPI_LOG_TIMESTAMP | Enables or disables the inclusion of a timestamp in the log message. Values can be `true` or `false` | string | `false`|
| STRAPI_LOG_FORCE_COLOR | Values can be `true` or `false` | string | `true` |
| STRAPI_LOG_PRETTY_PRINT | If pino-pretty module will be used to format logs. Values can be `true` or `false` | string | `true` |
## strapi build
Builds your admin panel.

View File

@ -188,10 +188,17 @@ class Strapi {
// Is the project initialised?
const isInitialised = await utils.isInitialised(this);
if (!isInitialised) {
this.logFirstStartupMessage();
} else {
this.logStartupMessage();
// Should the startup message be displayed?
const hideStartupMessage = process.env.STRAPI_HIDE_STARTUP_MESSAGE
? process.env.STRAPI_HIDE_STARTUP_MESSAGE === 'true'
: false;
if (hideStartupMessage === false) {
if (!isInitialised) {
this.logFirstStartupMessage();
} else {
this.logStartupMessage();
}
}
// Emit started event.