UNPKG

@porosys/ndtool

Version:

Netdata alert and automation tool

15 lines (14 loc) 449 B
import { homedir } from 'os'; import { join } from 'path'; import fsExtra from 'fs-extra'; const { readJson, writeJson, pathExists } = fsExtra; const configPath = join(homedir(), '.ndtoolrc'); export const saveConfig = async (config) => { await writeJson(configPath, config, { spaces: 2 }); }; export const loadConfig = async () => { if (await pathExists(configPath)) { return (await readJson(configPath)); } return null; };