diff --git a/docs/customization.md b/docs/customization.md index ce152db7..c7e35f47 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -5,9 +5,15 @@ while being built for maximal customizability. ## Configuration file -Vivify will look for an optional config file at `~/.vivify/config.json` and -`~/.vivify.json`. This file should contain a JSON object that can have the -following optional keys: +Vivify will look for an optional config file at + +- `~/.config/vivify/config.json`, +- `~/.config/vivify.json`, +- `~/.vivify/config.json`, and +- `~/.vivify.json`. + +This file should contain a JSON object that can have the following optional +keys: - **`"styles"`**\ A path to a single custom style sheet, or an array of multiple style sheets diff --git a/src/config.ts b/src/config.ts index a250515c..7bebd8e9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -38,6 +38,8 @@ const envConfigs: [string, keyof Config][] = [ const configFileBlocked: (keyof Config)[] = ['port']; const configPaths = [ + path.join(homedir(), '.config', 'vivify', 'config.json'), + path.join(homedir(), '.config', 'vivify.json'), path.join(homedir(), '.vivify', 'config.json'), path.join(homedir(), '.vivify.json'), ]; @@ -63,8 +65,8 @@ const config = ((): Config => { if (!fs.existsSync(cp)) continue; try { config = JSON.parse(fs.readFileSync(cp, 'utf8')); - break; } catch {} + break; } // revert to default config if no config found