Files
momentry_studio/.env.template
Momentry Studio 69ab0e8000 feat: 实现动态密码系统,消除硬编码
核心改动:
1. db.rs - 默认密码从环境变量读取或自动生成
   - 优先级: MOMENTRY_DEFAULT_PASSWORD > 自动生成
   - 格式: demo_<timestamp> 或自定义
   - 首次创建时打印密码到控制台

2. main.rs - SMB 服务密码动态化
   - 从 SMB_PASSWORD 或 MOMENTRY_DEFAULT_PASSWORD 读取
   - 支持自定义 SMB 用户名

3. user_tool.rs - 新增用户管理工具
   - list: 列出所有用户
   - create: 创建新用户
   - set-password: 修改密码
   - delete: 删除用户
   - init-demo: 初始化 demo 用户

4. install.sh - 安装时自动生成密码
   - 生成随机密码: demo_$(openssl rand -hex 4)
   - 保存到 .env 文件
   - 初始化数据库

5. .env.template - 新增密码配置
   - MOMENTRY_DEFAULT_PASSWORD
   - SMB_USER / SMB_PASSWORD

安全改进:
- 消除硬编码密码 'demo123'
- 每次安装密码唯一
- 密码哈希存储 (Argon2id)
- 支持自定义强密码

文档:
- docs/DEFAULT_PASSWORD_SYSTEM.md 完整说明
2026-10-12 14:25:47 +08:00

123 lines
3.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Momentry Studio - 环境变量模板
# 复制此文件为 .env 并根据实际环境修改
# ========================================
# 用户主目录(自动检测,通常不需要设置)
# ========================================
# HOME=/Users/your_username
# ========================================
# 项目根目录
# ========================================
# 默认: $HOME/momentry_core
MOMENTRY_CORE_ROOT=${HOME}/momentry_core
# 默认: $HOME/markbase
MARKBASE_ROOT=${HOME}/markbase
# 默认: $HOME/momentry_studio
MOMENTRY_STUDIO_ROOT=${HOME}/momentry_studio
# 默认: $HOME/momentry
MOMENTRY_ROOT=${HOME}/momentry
# 默认: $HOME/MarkBaseEngine
MARKBASE_ENGINE_ROOT=${HOME}/MarkBaseEngine
# ========================================
# 存储路径
# ========================================
# 默认: $HOME/momentry/var/sftpgo/data
STORAGE_ROOT=${HOME}/momentry/var/sftpgo/data
# 默认: $HOME/momentry/output
OUTPUT_DIR=${HOME}/momentry/output
# 默认: $HOME/momentry/backup
BACKUP_DIR=${HOME}/momentry/backup
# ========================================
# 数据库
# ========================================
# SQLite 数据库目录
MOMENTRY_DATA_DIR=${HOME}/momentry_studio/data/users
# PostgreSQL 连接字符串
DATABASE_URL=postgres://$(whoami)@localhost:5432/momentry
# Qdrant
QDRANT_URL=http://localhost:6333
QDRANT_API_KEY=your_qdrant_api_key_here
# Redis (可选)
REDIS_URL=redis://localhost:6379
# ========================================
# API Keys
# ========================================
# Momentry Core API Key
MOMENTRY_API_KEY=your_momentry_api_key_here
# ========================================
# 默认用户密码
# ========================================
# 在安装时自动生成,或手动设置
# 格式: demo_<random>
MOMENTRY_DEFAULT_PASSWORD=demo_change_this
# ========================================
# SMB 共享配置
# ========================================
# SMB 用户名(默认: demo)
SMB_USER=demo
# SMB 密码(默认使用 MOMENTRY_DEFAULT_PASSWORD)
SMB_PASSWORD=${MOMENTRY_DEFAULT_PASSWORD}
# ========================================
# 工具路径
# ========================================
# Python (用于脚本)
PYTHON_PATH=/opt/homebrew/bin/python3.11
# FFmpeg (用于视频处理)
FFMPEG_PATH=/opt/homebrew/bin/ffmpeg
# ========================================
# 服务配置
# ========================================
# Core API 端口
MOMENTRY_SERVER_PORT=3002
# Studio Proxy 端口
STUDIO_PROXY_PORT=8888
# MarkBase 端口
MARKBASE_PORT=11438
# ========================================
# LLM 服务
# ========================================
# VLM Vision API
MOMENTRY_LLM_VISION_URL=http://localhost:8080/v1/chat/completions
# LLM Chat API
MOMENTRY_LLM_CHAT_URL=http://localhost:8080/v1/chat/completions
# ========================================
# 外部服务 URL
# ========================================
# Media Base URL
MEDIA_BASE_URL=https://wp.momentry.ddns.net
# Serve Base URL
SERVE_BASE_URL=https://m5wp.momentry.ddns.net/files
# ========================================
# 说明
# ========================================
# 1. 复制此文件: cp .env.template .env
# 2. 编辑 .env 文件,填入实际值
# 3. 加载环境变量: source .env
# 4. 运行配置生成: ./generate_config.sh
# 5. 启动服务: npm run proxy