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

fix some startup problems

This commit is contained in:
Fedor Katurov 2025-02-24 19:48:12 +07:00
parent 969103d111
commit 96fea09b3f
3 changed files with 10 additions and 3 deletions

View file

@ -1,12 +1,15 @@
# Vk to Telegram bot # Vk to Telegram bot
### Configuring ### Configuring
Copy `config.example.yml` to `config.yml` and set it up. Copy `config.example.yml` to `config.yml` and set it up.
#### Running #### 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 #### Custom arguments
```bash ```bash
node ./dist/index.js \ node ./dist/index.js \
--config ./config-dev.yml --config ./config-dev.yml

View file

@ -5,6 +5,7 @@
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"environment": "docker-compose -f ./docker/docker-compose.yml up db -d",
"start": "node ./dist/index.js", "start": "node ./dist/index.js",
"dev": "NODE_ENV=dev node -r ts-node/register ./src/index.ts --config=./config.yml", "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", "build": "rm -rf ./dist && tsc && copyfiles -f ./config*.yml ./dist && copyfiles ./templates/*.md ./dist",

View file

@ -30,8 +30,11 @@ export default function prepareConfig() {
const key = JSON.parse( const key = JSON.parse(
fs.readFileSync(config.calendar?.keyFile).toString() fs.readFileSync(config.calendar?.keyFile).toString()
) as CalendarKeyFile; ) as CalendarKeyFile;
calendarKeyValidator.validateSync(key);
config.calendarKey = key; if (key) {
calendarKeyValidator.validateSync(key);
config.calendarKey = key;
}
} catch (error) { } catch (error) {
console.warn("tried to parse calendar key, got error", error); console.warn("tried to parse calendar key, got error", error);
} }