mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-29 14:53:02 +00: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) {
|
||||
let thisConfig = config;
|
||||
for (const step of path) {
|
||||
|
@ -399,6 +401,14 @@ function applyEnvOverrides(config: Source) {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue