More robust handling of mount timeout environment variable
This commit is contained in:
parent
78a75e8775
commit
a366460ae3
|
|
@ -10,7 +10,17 @@ const FINDMNT_COMMON_OPTIONS = [
|
||||||
"--nofsroot", // prevents unwanted behavior with cifs volumes
|
"--nofsroot", // prevents unwanted behavior with cifs volumes
|
||||||
];
|
];
|
||||||
|
|
||||||
const DEFAULT_TIMEOUT = process.env.MOUNT_DEFAULT_TIMEOUT ? +process.env.MOUNT_DEFAULT_TIMEOUT : 3000;
|
const DEFAULT_TIMEOUT = (() => {
|
||||||
|
const defaultValue = 30000;
|
||||||
|
if (process.env.MOUNT_DEFAULT_TIMEOUT) {
|
||||||
|
if (/^\d+$/.test(process.env.MOUNT_DEFAULT_TIMEOUT)) {
|
||||||
|
return parseInt(process.env.MOUNT_DEFAULT_TIMEOUT);
|
||||||
|
} else {
|
||||||
|
console.log("Invalid MOUNT_DEFAULT_TIMEOUT set: " + process.env.MOUNT_DEFAULT_TIMEOUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
})()
|
||||||
|
|
||||||
class Mount {
|
class Mount {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue