mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-22 16:43:09 +02:00
recognise numbers and boolean values
This commit is contained in:
parent
0e8cdb30b7
commit
4271402e0d
1 changed files with 10 additions and 0 deletions
|
@ -390,6 +390,8 @@ function applyEnvOverrides(config: Source) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const alwaysStrings = { 'chmodSocket': 1 };
|
||||||
|
|
||||||
function _assign(path: (string | number)[], lastStep: string | number, value: string) {
|
function _assign(path: (string | number)[], lastStep: string | number, value: string) {
|
||||||
let thisConfig = config;
|
let thisConfig = config;
|
||||||
for (const step of path) {
|
for (const step of path) {
|
||||||
|
@ -399,6 +401,14 @@ function applyEnvOverrides(config: Source) {
|
||||||
thisConfig = thisConfig[step];
|
thisConfig = thisConfig[step];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!alwaysStrings[lastStep]) {
|
||||||
|
if (value.match(/^[0-9]+$/)) {
|
||||||
|
value = parseInt(value);
|
||||||
|
} else if (value.match(/^(true|false)$/i)) {
|
||||||
|
value = !!value.match(/^true$/i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
thisConfig[lastStep] = value;
|
thisConfig[lastStep] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue