mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 06:37:10 -04:00
Fixed settings test.
This commit is contained in:
parent
f9fd9805c0
commit
1905e69463
2 changed files with 26 additions and 1 deletions
|
@ -629,6 +629,12 @@ const lookupEnvironmentVariables = (obj: MapArrayType<any>) => {
|
|||
* The environment variable expansion syntax "${ENV_VAR}" is just a string
|
||||
* of specific form, after all.
|
||||
*/
|
||||
|
||||
if(key === 'undefined' || value === undefined) {
|
||||
delete obj[key]
|
||||
continue
|
||||
}
|
||||
|
||||
if ((typeof value !== 'string' && typeof value !== 'object') || value === null) {
|
||||
obj[key] = value;
|
||||
continue
|
||||
|
@ -723,7 +729,9 @@ const lookupEnvironmentVariables = (obj: MapArrayType<any>) => {
|
|||
currentNode.addChild(pathToKey, value!)
|
||||
})
|
||||
|
||||
console.log(root.collectFromLeafsUpwards())
|
||||
//console.log(root.collectFromLeafsUpwards())
|
||||
//const rooting = root.collectFromLeafsUpwards()
|
||||
|
||||
obj = Object.assign(obj, envVars)
|
||||
return obj;
|
||||
};
|
||||
|
|
|
@ -73,6 +73,23 @@ export class SettingsNode {
|
|||
return collected;
|
||||
}
|
||||
|
||||
|
||||
public transformObjectWithArrays() {
|
||||
function isNumeric(str: string|object) {
|
||||
if (typeof str != "string") return false // we only process strings!
|
||||
// @ts-ignore
|
||||
return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
|
||||
!isNaN(parseFloat(str)) // ...and ensure strings of whitespace fail
|
||||
}
|
||||
let collected: MapArrayType<any> = {};
|
||||
for (const key in this.children) {
|
||||
if (isNumeric(key)) {
|
||||
Object.entries(this.children).map(([key, value]) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coerceValue = (stringValue: string) => {
|
||||
// cooked from https://stackoverflow.com/questions/175739/built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number
|
||||
// @ts-ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue