Default to 0600 when creating the custom settings file
The custom settings file will likely contain encryption keys and other sensitive data, so it's probably a good idea to tighten up the default permissions on it.
This commit is contained in:
parent
952312fbd3
commit
1252d60af0
1 changed files with 9 additions and 3 deletions
|
@ -12,9 +12,15 @@ const root_dir = path.dirname(process.argv[1]);
|
||||||
let filename_default = path.resolve(root_dir, "./settings.default.toml"),
|
let filename_default = path.resolve(root_dir, "./settings.default.toml"),
|
||||||
filename_custom = path.resolve(root_dir, "../settings.toml");
|
filename_custom = path.resolve(root_dir, "../settings.toml");
|
||||||
|
|
||||||
if(!fs.existsSync(filename_custom))
|
if(!fs.existsSync(filename_custom)) {
|
||||||
fs.writeFileSync(filename_custom, `# Custom settings file. This file overrides server/settings.default.toml - refer there for examples of settings you can override.\n\n`);
|
fs.writeFileSync(
|
||||||
|
filename_custom,
|
||||||
|
`# Custom settings file. This file overrides server/settings.default.toml - refer there for examples of settings you can override.\n\n`, {
|
||||||
|
mode: 0o600
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
let settings = toml.parse(fs.readFileSync(filename_default, "utf-8")),
|
let settings = toml.parse(fs.readFileSync(filename_default, "utf-8")),
|
||||||
settings_override = toml.parse(fs.readFileSync(filename_custom, "utf-8"));
|
settings_override = toml.parse(fs.readFileSync(filename_custom, "utf-8"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue