fix bug
This commit is contained in:
+13
-29
@@ -65,11 +65,11 @@ authInternalUsers:
|
||||
- action: api
|
||||
```
|
||||
|
||||
Sau đó set trong file `.env` của dashboard backend:
|
||||
Sau đó set trực tiếp trong `api/data/config.json` của dashboard backend:
|
||||
|
||||
```
|
||||
MEDIAMTX_API_USER=dashboard
|
||||
MEDIAMTX_API_PASS=dashboard_password
|
||||
"mediamtx_api_user": "dashboard",
|
||||
"mediamtx_api_pass": "dashboard_password"
|
||||
```
|
||||
|
||||
Trong `paths`, bạn có thể để dashboard tự thêm path bằng API (Settings → Add Camera).
|
||||
@@ -128,21 +128,16 @@ pip install -r api/requirements.txt
|
||||
|
||||
### 3.2 Cấu hình
|
||||
|
||||
Tạo file `.env`:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Backend sẽ tự load `.env` khi start.
|
||||
|
||||
Chạy backend lần đầu sẽ tự tạo `api/data/config.json` (lưu danh sách camera + schedule).
|
||||
Backend chỉ đọc cấu hình từ `api/data/config.json` (không đọc `.env`).
|
||||
Chạy lần đầu sẽ tự tạo file này (lưu camera + schedule + các tham số backend).
|
||||
|
||||
Bạn có thể chỉnh:
|
||||
|
||||
- `mediamtx_api_url` (mặc định `http://127.0.0.1:9997`)
|
||||
- `mediamtx_webrtc_url` (mặc định `http://127.0.0.1:8889`)
|
||||
- `recordings_dir` (mặc định `/recordings`)
|
||||
- `mediamtx_api_user` / `mediamtx_api_pass` (nếu bật auth API của MediaMTX)
|
||||
- `recordings_dir` (mặc định `./mediamtx/recordings` trong project)
|
||||
- `api_port` (mặc định `8008`)
|
||||
|
||||
Nếu chạy mô hình 2 thiết bị, set theo IP máy A (MediaMTX), ví dụ:
|
||||
|
||||
@@ -150,30 +145,20 @@ Nếu chạy mô hình 2 thiết bị, set theo IP máy A (MediaMTX), ví dụ:
|
||||
{
|
||||
"mediamtx_api_url": "http://192.168.88.10:9997",
|
||||
"mediamtx_webrtc_url": "http://192.168.88.10:8889",
|
||||
"recordings_dir": "/recordings",
|
||||
"mediamtx_api_user": null,
|
||||
"mediamtx_api_pass": null,
|
||||
"recordings_dir": "./mediamtx/recordings",
|
||||
"api_port": 8008,
|
||||
"cameras": [],
|
||||
"schedule": { "enabled": true, "weekdays_from": "18:00", "weekdays_to": "08:00", "weekend_all_day": true }
|
||||
}
|
||||
```
|
||||
|
||||
Hoặc set ENV trước lần chạy đầu tiên để tạo config mặc định:
|
||||
|
||||
```bash
|
||||
export MEDIAMTX_API_URL="http://192.168.88.10:9997"
|
||||
export MEDIAMTX_WEBRTC_URL="http://192.168.88.10:8889"
|
||||
export RECORDINGS_DIR="/recordings"
|
||||
```
|
||||
|
||||
Nếu MediaMTX API có auth, set trong `.env`:
|
||||
|
||||
- `MEDIAMTX_API_USER`
|
||||
- `MEDIAMTX_API_PASS`
|
||||
|
||||
### 3.3 Chạy backend
|
||||
|
||||
```bash
|
||||
source api/.venv/bin/activate
|
||||
python3 api/run.py
|
||||
python3 -m api.run
|
||||
```
|
||||
|
||||
## 4) Frontend (build static)
|
||||
@@ -234,7 +219,6 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/ipcam-dashboard
|
||||
EnvironmentFile=/opt/ipcam-dashboard/.env
|
||||
ExecStart=/opt/ipcam-dashboard/api/.venv/bin/python /opt/ipcam-dashboard/api/run.py
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
Reference in New Issue
Block a user