diff --git a/.gitignore b/.gitignore index 43f5311..6f25554 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -.DS_Store - # Logs logs *.log @@ -128,13 +126,6 @@ dist *.iml .idea -img - - -# Intellij -.idea/ -*.iml - # Python __pycache__ @@ -146,9 +137,8 @@ __pycache__ mongo-data ##dotenv environment variable files +.secrets.* .env -.env.development.local -.env.production -## image output +## images output img diff --git a/Backend/src/database/database.service.ts b/Backend/src/database/database.service.ts index 894ae32..c5216fb 100644 --- a/Backend/src/database/database.service.ts +++ b/Backend/src/database/database.service.ts @@ -42,6 +42,7 @@ export class DatabaseService { }); } }); + // If the user exists but the password is not hashed it will hash it this.DB.collection('users').findOneAndUpdate( { name: process.env.CSD_USER, diff --git a/Backend/src/telegram/telegram.service.ts b/Backend/src/telegram/telegram.service.ts index 0c3a24c..fd677c8 100644 --- a/Backend/src/telegram/telegram.service.ts +++ b/Backend/src/telegram/telegram.service.ts @@ -80,7 +80,7 @@ export class TelegramService { } await this.bot.sendMessage( msg.chat.id, - `Intrusion detection ${status ? 'enabled' : 'disabled'}`, + `Intrusion detection notifications: ${status ? 'enabled' : 'disabled'}`, ); return; } @@ -92,7 +92,6 @@ export class TelegramService { ) { const users = await this.databaseService.getRawDataArray('users'); - // TODO test filter users .filter((user) => user.getsAlerts) .map((user) => user.telegramId) diff --git a/README.md b/README.md index a8e8f14..8f50b16 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,26 @@ The repository contains the sources code for the Camera Security System project. ## Just Run -Firstly add .env file to root directory using the following template -```text +Firstly add .secrets.yml file to root directory using the following template +```yaml +# mongodb+srv is the protocol when connecting to cloud mongodb MONGO_PROTOCOL=mongodb +# mongo:27017 indicates the container called mongo and the port it is listening on MONGO_HOST=mongo:27017 +# DB root username MONGO_INITDB_ROOT_USERNAME=username +# DB root password MONGO_INITDB_ROOT_PASSWORD=password +# JWT cryptographic secret JWT_SECRET=secret +# User to access the backend CSD_USER=User +# Password to access the backend CSD_PASSWORD=Password +# Telegram bot token TELEGRAM_TOKEN=api_token +# Should be of the format of BCrypt hash +BCRYPT_SALT=... ``` Then you can run ```bash diff --git a/docker-compose.yml b/docker-compose.yml index d06e93f..83b94ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: volumes: - ./mongo-data:/data/db env_file: - - .env + - .secrets.yml backend: container_name: backend @@ -24,6 +24,6 @@ services: volumes: - ./Backend:/home/node env_file: - - .env + - .secrets.yml # command: npm start command: npm run start -- --watch