feat: add system future config

This commit is contained in:
Joe 2024-08-29 16:53:55 +08:00
parent ede775cb6a
commit 3c747bc6d0
4 changed files with 28 additions and 3 deletions

View File

@ -279,6 +279,9 @@ POSITION_PROVIDER_INCLUDES=
POSITION_PROVIDER_EXCLUDES=
# Login
ENABLE_EMAIL_CODE_LOGIN=
ENABLE_EMAIL_PASSWORD_LOGIN=
ENABLE_SOCIAL_OAUTH_LOGIN=
EMAIL_CODE_LOGIN_TOKEN_EXPIRY_HOURS=1/12
ALLOW_REGISTER=true
ALLOW_CREATE_WORKSPACE=true

View File

@ -612,6 +612,18 @@ class PositionConfig(BaseSettings):
class LoginConfig(BaseSettings):
ENABLE_EMAIL_CODE_LOGIN: bool = Field(
description="whether to enable email code login",
default=True,
)
ENABLE_EMAIL_PASSWORD_LOGIN: bool = Field(
description="whether to enable email password login",
default=True,
)
ENABLE_SOCIAL_OAUTH_LOGIN: bool = Field(
description="whether to enable github/google oauth login",
default=True,
)
EMAIL_CODE_LOGIN_TOKEN_EXPIRY_HOURS: PositiveFloat = Field(
description="expiry time in hours for email code login token",
default=1 / 12,

View File

@ -42,6 +42,9 @@ class SystemFeatureModel(BaseModel):
sso_enforced_for_web: bool = False
sso_enforced_for_web_protocol: str = ""
enable_web_sso_switch_component: bool = False
enable_email_code_login: bool = dify_config.ENABLE_EMAIL_CODE_LOGIN
enable_email_password_login: bool = dify_config.ENABLE_EMAIL_PASSWORD_LOGIN
enable_social_oauth_login: bool = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN
class FeatureService:

View File

@ -507,8 +507,7 @@ INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=1000
INVITE_EXPIRY_HOURS=72
# Reset password token valid time (hours),
# Default: 24.
RESET_PASSWORD_TOKEN_EXPIRY_HOURS=24
RESET_PASSWORD_TOKEN_EXPIRY_HOURS=1/12
# The sandbox service endpoint.
CODE_EXECUTION_ENDPOINT=http://sandbox:8194
@ -721,4 +720,12 @@ POSITION_TOOL_EXCLUDES=
# Example: POSITION_PROVIDER_PINS=openai,openllm
POSITION_PROVIDER_PINS=
POSITION_PROVIDER_INCLUDES=
POSITION_PROVIDER_EXCLUDES=
POSITION_PROVIDER_EXCLUDES=
# LoginConfig
ENABLE_EMAIL_CODE_LOGIN=
ENABLE_EMAIL_PASSWORD_LOGIN=
ENABLE_SOCIAL_OAUTH_LOGIN=
EMAIL_CODE_LOGIN_TOKEN_EXPIRY_HOURS=1/12
ALLOW_REGISTER=true
ALLOW_CREATE_WORKSPACE=true