Skip to content

Commit

Permalink
Add ENV to allow hiding startup message (strapi#6348)
Browse files Browse the repository at this point in the history
* 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>
Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
  • Loading branch information
3 people authored and onepointconsulting committed Aug 13, 2020
1 parent 95d56f9 commit 2180703
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 9 additions & 0 deletions docs/v3.x/cli/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 11 additions & 4 deletions packages/strapi/lib/Strapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,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.
Expand Down

0 comments on commit 2180703

Please sign in to comment.