Settings: Deprecate null as the default default value

This commit is contained in:
Richard Hansen 2021-06-06 02:36:09 -04:00
parent aa221698c8
commit 428f8d1684
4 changed files with 12 additions and 3 deletions

View file

@ -23,6 +23,9 @@
`"${UNSET_VAR:undefined}"`), the setting is now removed instead of set to `"${UNSET_VAR:undefined}"`), the setting is now removed instead of set to
the string "undefined". It is no longer possible to produce the string the string "undefined". It is no longer possible to produce the string
"undefined" via environment variable substitution. "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 ### Notable enhancements

View file

@ -45,7 +45,9 @@
* - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set * - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set
* to null, if used as a member of an array). * to null, if used as a member of an array).
* - If the environment variable is unset and no default value is provided, * - 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: * EXAMPLE:
* "port": "${PORT:9001}" * "port": "${PORT:9001}"

View file

@ -36,7 +36,9 @@
* - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set * - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set
* to null, if used as a member of an array). * to null, if used as a member of an array).
* - If the environment variable is unset and no default value is provided, * - 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: * EXAMPLE:
* "port": "${PORT:9001}" * "port": "${PORT:9001}"

View file

@ -599,7 +599,9 @@ const lookupEnvironmentVariables = (obj) => {
if ((envVarValue === undefined) && (defaultValue === undefined)) { if ((envVarValue === undefined) && (defaultValue === undefined)) {
console.warn(`Environment variable "${envVarName}" does not contain any value for ` + 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 * We have to return null, because if we just returned undefined, the