数据层可插拔(SQLite/MariaDB) + 后端 services 骨架
- database.ts 改为按 DB_TYPE 切换 SQLite / MariaDB(mysql2),sqlite3 按需动态导入 - index.ts 改为初始化数据库后再监听端口 - 新增 AuthService / HealthService / AnalysisService / GarminService - 新增 .gitignore、server/.env(忽略) 与 .env.example - README 增加数据库配置说明;package.json 增加 mysql2/@types
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
# Server Configuration
|
||||
# App
|
||||
PORT=5000
|
||||
NODE_ENV=development
|
||||
|
||||
# Database
|
||||
DATABASE_PATH=./data/health.db
|
||||
|
||||
# JWT
|
||||
JWT_SECRET=your_jwt_secret_key_here_change_in_production
|
||||
|
||||
# CORS
|
||||
JWT_SECRET=generate_a_random_string
|
||||
CORS_ORIGIN=http://localhost:3000
|
||||
|
||||
# Garmin Configuration
|
||||
# Note: Consider using OAuth instead of storing credentials
|
||||
GARMIN_CONNECT_USER=your_garmin_email@example.com
|
||||
GARMIN_CONNECT_PASSWORD=your_password_here
|
||||
# --- Database ---
|
||||
# Local/dev: SQLite (zero config)
|
||||
# DB_TYPE=sqlite
|
||||
# DATABASE_PATH=./data/health.db
|
||||
#
|
||||
# Production: MariaDB on the NAS
|
||||
DB_TYPE=mariadb
|
||||
MARIADB_SOCKET=/run/mysqld/mysqld10.sock
|
||||
MARIADB_USER=root
|
||||
MARIADB_PASSWORD=your_nas_mariadb_root_password
|
||||
MARIADB_DATABASE=garmin_health_lab
|
||||
|
||||
# Data Sync
|
||||
SYNC_INTERVAL_HOURS=1
|
||||
# Garmin Connect
|
||||
GARMIN_CONNECT_USER=your_garmin_email
|
||||
GARMIN_CONNECT_PASSWORD=your_garmin_password
|
||||
|
||||
Reference in New Issue
Block a user