Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine
FROM node:20-slim
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile doesn't create the /app/data directory that's needed for the database file when using DB_PATH=/app/data.db. Consider adding 'RUN mkdir -p /app/data' before the CMD instruction to ensure the directory exists when the container starts.

Copilot uses AI. Check for mistakes.
WORKDIR /app
COPY package*.json ./
RUN npm install
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ npm install
```env
TELEGRAM_TOKEN=your_telegram_bot_token
WEBAPP_URL=http://localhost:5000
DB_PATH=/path/to/data/data.db # use in development mode (not needed for docker-compose setup)
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation suggests using an absolute path like "/path/to/data/data.db" but this might be confusing. For local development, the path should typically be relative to the project root (e.g., "./data/data.db" or an absolute path using __dirname). Consider clarifying the expected path format or providing a concrete example that users can actually use.

Suggested change
DB_PATH=/path/to/data/data.db # use in development mode (not needed for docker-compose setup)
DB_PATH=./data/data.db # путь к файлу БД относительно корня проекта (для локальной разработки; не нужен для docker-compose)

Copilot uses AI. Check for mistakes.
```

4. Запустите приложение в режиме разработки:
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
environment:
- TELEGRAM_TOKEN=${TELEGRAM_TOKEN}
- WEBAPP_URL=${WEBAPP_URL}
- DB_PATH=/app/data.db
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a trailing space after the DB_PATH value. Remove the space at the end of this line to avoid potential issues with the environment variable value.

Suggested change
- DB_PATH=/app/data.db
- DB_PATH=/app/data.db

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mismatch between the DB_PATH environment variable and the volume mapping. DB_PATH is set to /app/data.db but the volume maps ./data to /data (not /app/data). This will cause the database file to be created at /app/data.db inside the container, which won't be persisted to the host because the volume is mounted at /data. Either change DB_PATH to /data/data.db or change the volume mapping to ./data:/app/data.

Suggested change
- DB_PATH=/app/data.db
- DB_PATH=/data/data.db

Copilot uses AI. Check for mistakes.
volumes:
- ./data.db:/app/data.db
- ./data:/data
restart: unless-stopped
2 changes: 1 addition & 1 deletion src/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Entry } from "./entity/Entry";

export const AppDataSource = new DataSource({
type: "sqlite",
database: "data.db",
database: process.env.DB_PATH || "data.db",
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's extra spacing between 'database:' and 'process.env.DB_PATH'. While this doesn't affect functionality, it's inconsistent with the typical code style. Consider using a single space for consistency.

Suggested change
database: process.env.DB_PATH || "data.db",
database: process.env.DB_PATH || "data.db",

Copilot uses AI. Check for mistakes.
synchronize: true,
logging: false,
entities: [User, Entry],
Expand Down