diff --git a/README.md b/README.md index 91d6ad9..557c571 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # Vk to Telegram bot ### Configuring + Copy `config.example.yml` to `config.yml` and set it up. #### Running -`yarn && yarn build && node ./dist/index.js` + +Setup environment: `yarn environment`, then run the application: `yarn && yarn build && node ./dist/index.js` #### Custom arguments + ```bash node ./dist/index.js \ --config ./config-dev.yml diff --git a/package.json b/package.json index 8bc631e..bf14297 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "license": "MIT", "scripts": { + "environment": "docker-compose -f ./docker/docker-compose.yml up db -d", "start": "node ./dist/index.js", "dev": "NODE_ENV=dev node -r ts-node/register ./src/index.ts --config=./config.yml", "build": "rm -rf ./dist && tsc && copyfiles -f ./config*.yml ./dist && copyfiles ./templates/*.md ./dist", diff --git a/src/config/index.ts b/src/config/index.ts index dc3c6c0..c483e43 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -30,8 +30,11 @@ export default function prepareConfig() { const key = JSON.parse( fs.readFileSync(config.calendar?.keyFile).toString() ) as CalendarKeyFile; - calendarKeyValidator.validateSync(key); - config.calendarKey = key; + + if (key) { + calendarKeyValidator.validateSync(key); + config.calendarKey = key; + } } catch (error) { console.warn("tried to parse calendar key, got error", error); }