Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Tenant ID length limits (min 3, max 50) were hardcoded in src/tenant_deps.py, limiting business flexibility for different use cases.

Changes

  • src/config.py: Add tenant_id_min_length and tenant_id_max_length fields to MultiTenantConfig
  • src/tenant_deps.py: Use config values instead of hardcoded constants for validation and FastAPI Query params
  • env.example: Document new environment variables

Usage

# Custom length constraints (defaults: 3-50)
TENANT_ID_MIN_LENGTH=5
TENANT_ID_MAX_LENGTH=100

Config values are cached at module load time—requires service restart to take effect.

Original prompt

This section details on the original issue you should resolve

<issue_title>Tenant ID length constraints hardcoded - reduces business flexibility</issue_title>
<issue_description>## 问题描述
Tenant ID 长度限制硬编码,降低业务灵活性。

受影响的文件

  • src/tenant_deps.py 行 36-37

硬编码值

  • 最小 3 字符
  • 最大 50 字符

问题

某些业务场景可能需要不同的限制。

解决方案

应该配置以下环境变量:

  • TENANT_ID_MIN_LENGTH
  • TENANT_ID_MAX_LENGTH</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: BukeLy <19304666+BukeLy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update hardcoded tenant ID length constraints feat: make Tenant ID length constraints configurable via environment variables Dec 15, 2025
Copilot AI requested a review from BukeLy December 15, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tenant ID length constraints hardcoded - reduces business flexibility

2 participants