Skip to content

Commit

Permalink
Settings: Deprecate null as the default default value
Browse files Browse the repository at this point in the history
  • Loading branch information
rhansen committed Jun 6, 2021
1 parent aa22169 commit 428f8d1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
`"${UNSET_VAR:undefined}"`), the setting is now removed instead of set to
the string "undefined". It is no longer possible to produce the string
"undefined" via environment variable substitution.
* Support for unset variables without a default value is now deprecated.
Please change all instances of `"${FOO}"` in your `settings.json` to
`${FOO:null}` to keep the current behavior.

### Notable enhancements

Expand Down
4 changes: 3 additions & 1 deletion settings.json.docker
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
* - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set
* to null, if used as a member of an array).
* - If the environment variable is unset and no default value is provided,
* the value becomes null.
* the value becomes null. THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF
* ETHERPAD; if you want the default value to be null, you should explicitly
* specify "null" as the default value.
*
* EXAMPLE:
* "port": "${PORT:9001}"
Expand Down
4 changes: 3 additions & 1 deletion settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
* - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set
* to null, if used as a member of an array).
* - If the environment variable is unset and no default value is provided,
* the value becomes null.
* the value becomes null. THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF
* ETHERPAD; if you want the default value to be null, you should explicitly
* specify "null" as the default value.
*
* EXAMPLE:
* "port": "${PORT:9001}"
Expand Down
4 changes: 3 additions & 1 deletion src/node/utils/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,9 @@ const lookupEnvironmentVariables = (obj) => {

if ((envVarValue === undefined) && (defaultValue === undefined)) {
console.warn(`Environment variable "${envVarName}" does not contain any value for ` +
`configuration key "${key}", and no default was given. Returning null.`);
`configuration key "${key}", and no default was given. Using null. ` +
'THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF ETHERPAD; you should ' +
'explicitly use "null" as the default if you want to continue to use null.');

/*
* We have to return null, because if we just returned undefined, the
Expand Down

0 comments on commit 428f8d1

Please sign in to comment.