1+ # ====================================
2+ # Label Studio Adapter Configuration
3+ # ====================================
4+
5+ # =========================
6+ # 应用程序配置
7+ # =========================
8+ APP_NAME = " Label Studio Adapter"
9+ APP_VERSION = " 1.0.0"
10+ APP_DESCRIPTION = " Adapter for integrating Data Management System with Label Studio"
11+ DEBUG = true
12+
13+ # =========================
14+ # 服务器配置
15+ # =========================
16+ HOST = 0.0.0.0
17+ PORT = 18000
18+
19+ # =========================
20+ # 日志配置
21+ # =========================
22+ LOG_LEVEL = INFO
23+
24+ # =========================
25+ # Label Studio 服务配置
26+ # =========================
27+ # Label Studio 服务地址(根据部署方式调整)
28+ # Docker 环境:http://label-studio:8080
29+ # 本地开发:http://127.0.0.1:8000
30+ LABEL_STUDIO_BASE_URL = http://label-studio:8080
31+
32+ # Label Studio 用户名和密码(用于自动创建用户)
33+ LABEL_STUDIO_USERNAME = admin@example.com
34+ LABEL_STUDIO_PASSWORD = password
35+
36+ # Label Studio API 认证 Token(Legacy Token,推荐使用)
37+ # 从 Label Studio UI 的 Account & Settings > Access Token 获取
38+ LABEL_STUDIO_USER_TOKEN = your-label-studio-token-here
39+
40+ # Label Studio 本地文件存储基础路径(容器内路径,用于 Docker 部署时的权限检查)
41+ LABEL_STUDIO_LOCAL_BASE = /label-studio/local_files
42+
43+ # Label Studio 本地文件服务路径前缀(任务数据中的文件路径前缀)
44+ LABEL_STUDIO_FILE_PATH_PREFIX = /data/local-files/?d=
45+
46+ # Label Studio 容器中的本地存储路径(用于配置 Local Storage)
47+ LABEL_STUDIO_LOCAL_STORAGE_DATASET_BASE_PATH = /label-studio/local_files/dataset
48+ LABEL_STUDIO_LOCAL_STORAGE_UPLOAD_BASE_PATH = /label-studio/local_files/upload
49+
50+ # Label Studio 任务列表分页大小
51+ LS_TASK_PAGE_SIZE = 1000
52+
53+ # =========================
54+ # Data Management 服务配置
55+ # =========================
56+ # DM 服务地址
57+ DM_SERVICE_BASE_URL = http://data-engine:8080
58+
59+ # DM 存储文件夹前缀(通常与 Label Studio 的 local-files 文件夹映射一致)
60+ DM_FILE_PATH_PREFIX = /
61+
62+ # =========================
63+ # Adapter 数据库配置 (MySQL)
64+ # =========================
65+ # 优先级1:如果配置了 MySQL,将优先使用 MySQL 数据库
66+ MYSQL_HOST = adapter-db
67+ MYSQL_PORT = 3306
68+ MYSQL_USER = label_studio_user
69+ MYSQL_PASSWORD = user_password
70+ MYSQL_DATABASE = label_studio_adapter
71+
72+ # =========================
73+ # Label Studio 数据库配置 (PostgreSQL)
74+ # =========================
75+ # 仅在使用 docker-compose.label-studio.yml 启动 Label Studio 时需要配置
76+ POSTGRES_HOST = label-studio-db
77+ POSTGRES_PORT = 5432
78+ POSTGRES_USER = labelstudio
79+ POSTGRES_PASSWORD = labelstudio@4321
80+ POSTGRES_DATABASE = labelstudio
81+
82+ # =========================
83+ # SQLite 数据库配置(兜底选项)
84+ # =========================
85+ # 优先级3:如果没有配置 MySQL/PostgreSQL,将使用 SQLite
86+ SQLITE_PATH = ./data/labelstudio_adapter.db
87+
88+ # =========================
89+ # 可选:直接指定数据库 URL
90+ # =========================
91+ # 如果设置了此项,将覆盖上面的 MySQL/PostgreSQL/SQLite 配置
92+ # DATABASE_URL=postgresql+asyncpg://user:password@host:port/database
93+
94+ # =========================
95+ # 安全配置
96+ # =========================
97+ # 密钥(生产环境务必修改)
98+ SECRET_KEY = your-secret-key-change-this-in-production
99+
100+ # Token 过期时间(分钟)
101+ ACCESS_TOKEN_EXPIRE_MINUTES = 30
102+
103+ # =========================
104+ # CORS 配置
105+ # =========================
106+ # 允许的来源(生产环境建议配置具体域名)
107+ ALLOWED_ORIGINS = ["*"]
108+
109+ # 允许的 HTTP 方法
110+ ALLOWED_METHODS = ["*"]
111+
112+ # 允许的请求头
113+ ALLOWED_HEADERS = ["*"]
114+
115+ # =========================
116+ # Docker Compose 配置
117+ # =========================
118+ # Docker Compose 项目名称前缀
119+ COMPOSE_PROJECT_NAME = ls-adapter
120+
121+ # =========================
122+ # 同步配置(未来扩展)
123+ # =========================
124+ # 批量同步任务的批次大小
125+ SYNC_BATCH_SIZE = 100
126+
127+ # 同步失败时的最大重试次数
128+ MAX_RETRIES = 3
0 commit comments