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:
parent
e3bf4fef86
commit
51fe9160ca
6 changed files with 45 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue