Skip to content

Commit

Permalink
Merge pull request #7 from unicam-complex-system/glydric
Browse files Browse the repository at this point in the history
renamed .env file to .secrets.yml
  • Loading branch information
nabil-nablotech authored Dec 22, 2023
2 parents a64fb1d + 22bcc78 commit ce96aa3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
14 changes: 2 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store

# Logs
logs
*.log
Expand Down Expand Up @@ -128,13 +126,6 @@ dist
*.iml
.idea

img


# Intellij
.idea/
*.iml

# Python
__pycache__

Expand All @@ -146,9 +137,8 @@ __pycache__
mongo-data

##dotenv environment variable files
.secrets.*
.env
.env.development.local
.env.production

## image output
## images output
img
1 change: 1 addition & 0 deletions Backend/src/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions Backend/src/telegram/telegram.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
volumes:
- ./mongo-data:/data/db
env_file:
- .env
- .secrets.yml

backend:
container_name: backend
Expand All @@ -24,6 +24,6 @@ services:
volumes:
- ./Backend:/home/node
env_file:
- .env
- .secrets.yml
# command: npm start
command: npm run start -- --watch

0 comments on commit ce96aa3

Please sign in to comment.