1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 15:06:41 +07:00

added argument parser

This commit is contained in:
Fedor Katurov 2021-04-07 17:56:52 +07:00
parent e3bf4fef86
commit 51fe9160ca
6 changed files with 45 additions and 2 deletions

View file

@ -5,9 +5,11 @@ import { Config } from './types';
import { mergeRight } from 'ramda';
import { validateConfig } from './validate';
import logger from '../service/logger';
import { getCmdArg } from '../utils/args';
const configPath = getCmdArg('config')
const defaultConfig = yaml.load<Config>(fs.readFileSync(path.join(__dirname, '../config.example.yml'), 'utf8'));
const userConfig = yaml.load<Config>(fs.readFileSync(path.join(__dirname, '../config.yml'), 'utf8'));
const userConfig = yaml.load<Config>(fs.readFileSync(configPath || path.join(__dirname, '../config.yml'), 'utf8'));
const config = userConfig && mergeRight(defaultConfig, userConfig) || defaultConfig