add use of STRAPI_DISABLE_UPDATE_NOTIFICATION

Signed-off-by: Pierre Noël <petersg83@gmail.com>
This commit is contained in:
Pierre Noël 2020-11-06 15:19:18 +01:00
parent cf2a4c28ed
commit 59ac2dd6f4
6 changed files with 28 additions and 4 deletions

View File

@ -50,6 +50,26 @@ module.exports = ({ env }) => {
## Environment variables
### List of Strapi's environment variables
Some settings can only be modified through environment variables. Here is a list of those settings are associated environment variable names:
| name | description | type | default |
| ------------------------------------ | ---------------------------------------------------------------------------------- | ------- | ------------------------- |
| `NODE_ENV` | Type of environment where the app is running | string | `'development'` |
| `STRAPI_DISABLE_UPDATE_NOTIFICATION` | Don't show the notification message about updating strapi in the terminal | boolean | `false` |
| `STRAPI_HIDE_STARTUP_MESSAGE` | Don't show the startup message in the terminal | boolean | `false` |
| `STRAPI_TELEMETRY_DISABLED` | Don't send telemetry usage data to Strapi | boolean | `false` |
| `BROWSER` | Open the admin panel in the browser after startup | boolean | `true` |
| `STRAPI_LICENSE` | The license key to activate the Enterprise Edition | string | `undefined` |
| `ENV_PATH` | Path to the file that contains your environment variables | string | `'./.env'` |
| `STRAPI_LOG_TIMESTAMP` | Add the timestamp info in logs | boolean | `false` |
| `STRAPI_LOG_LEVEL` | Select the level of logs among `fatal`, `error`, `warn`, `info`, `debug`, `trace`. | string | `'info'` |
| `HOST` | Host on which the app runs | string | `'0.0.0.0' | 'localhost'` |
| `PORT` | Port on which the app runs | number | `1337` |
### Configuration using environment variables
In most use cases you will have different configurations between your environments. For example: your database credentials.
Instead of writing those credentials into your configuration files, you can define those variables in a `.env` file at the root of your application.
@ -86,7 +106,7 @@ module.exports = ({ env }) => ({
});
```
### Casting environment variables
#### Casting environment variables
```js
// Returns the env if defined without casting it

View File

@ -31,6 +31,7 @@ const { getConfigUrls, getAbsoluteAdminUrl, getAbsoluteServerUrl } = require('./
const { generateTimestampCode } = require('./code-generator');
const contentTypes = require('./content-types');
const webhook = require('./webhook');
const env = require('./env-helper');
module.exports = {
yup,
@ -61,4 +62,5 @@ module.exports = {
stringEquals,
contentTypes,
webhook,
env,
};

View File

@ -2,9 +2,7 @@
const path = require('path');
const fs = require('fs');
const { templateConfiguration } = require('strapi-utils');
const env = require('./env-helper');
const { templateConfiguration, env } = require('strapi-utils');
module.exports = dir => {
if (!fs.existsSync(dir)) return {};

View File

@ -6,6 +6,7 @@ const boxen = require('boxen');
const chalk = require('chalk');
const path = require('path');
const pkg = require('../../../package');
const { env } = require('strapi-utils');
const CHECK_INTERVAL = 1000 * 60 * 60 * 24 * 1; // 1 day
const NOTIF_INTERVAL = 1000 * 60 * 60 * 24 * 7; // 1 week
const boxenOptions = {
@ -73,6 +74,9 @@ const createUpdateNotifier = strapi => {
return {
notify({ checkInterval = CHECK_INTERVAL, notifInterval = NOTIF_INTERVAL } = {}) {
if (env.bool('STRAPI_DISABLE_UPDATE_NOTIFICATION', false)) {
return;
}
display(notifInterval);
checkUpdate(checkInterval); // doesn't need to await
},