Comparing version 10.0.3 to 10.1.0
@@ -75,2 +75,3 @@ "use strict"; | ||
accessPropertiesByDotNotation: true, | ||
configFileMode: 0o666, | ||
...partialOptions | ||
@@ -371,7 +372,7 @@ }; | ||
if (process.env.SNAP) { | ||
fs.writeFileSync(this.path, data); | ||
fs.writeFileSync(this.path, data, { mode: __classPrivateFieldGet(this, _Conf_options, "f").configFileMode }); | ||
} | ||
else { | ||
try { | ||
atomically.writeFileSync(this.path, data); | ||
atomically.writeFileSync(this.path, data, { mode: __classPrivateFieldGet(this, _Conf_options, "f").configFileMode }); | ||
} | ||
@@ -383,3 +384,3 @@ catch (error) { | ||
if ((error === null || error === void 0 ? void 0 : error.code) === 'EXDEV') { | ||
fs.writeFileSync(this.path, data); | ||
fs.writeFileSync(this.path, data, { mode: __classPrivateFieldGet(this, _Conf_options, "f").configFileMode }); | ||
return; | ||
@@ -386,0 +387,0 @@ } |
@@ -200,2 +200,12 @@ /// <reference types="node" /> | ||
readonly watch?: boolean; | ||
/** | ||
The [mode](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) that will be used for the config file. | ||
You would usually not need this, but it could be useful if you want to restrict the permissions of the config file. Setting a permission such as `0o600` would result in a config file that can only be accessed by the user running the program. | ||
Note that setting restrictive permissions can cause problems if different users need to read the file. A common problem is a user running your tool with and without `sudo` and then not being able to access the config the second time. | ||
@default 0o666 | ||
*/ | ||
readonly configFileMode: number; | ||
} | ||
@@ -202,0 +212,0 @@ export declare type Migrations<T> = Record<string, (store: Conf<T>) => void>; |
{ | ||
"name": "conf", | ||
"version": "10.0.3", | ||
"version": "10.1.0", | ||
"description": "Simple config handling for your app or module", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -272,2 +272,13 @@ # conf | ||
#### configFileMode | ||
Type: `number`\ | ||
Default: `0o666` | ||
The [mode](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) that will be used for the config file. | ||
You would usually not need this, but it could be useful if you want to restrict the permissions of the config file. Setting a permission such as `0o600` would result in a config file that can only be accessed by the user running the program. | ||
Note that setting restrictive permissions can cause problems if different users need to read the file. A common problem is a user running your tool with and without `sudo` and then not being able to access the config the second time. | ||
### Instance | ||
@@ -274,0 +285,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47792
727
400