feat: add fulfill_login_params_from_env
This commit is contained in:
parent
bc025856b4
commit
3e83be941c
@ -611,7 +611,7 @@ class PositionConfig(BaseSettings):
|
|||||||
class LoginConfig(BaseSettings):
|
class LoginConfig(BaseSettings):
|
||||||
ENABLE_EMAIL_CODE_LOGIN: bool = Field(
|
ENABLE_EMAIL_CODE_LOGIN: bool = Field(
|
||||||
description="whether to enable email code login",
|
description="whether to enable email code login",
|
||||||
default=True,
|
default=False,
|
||||||
)
|
)
|
||||||
ENABLE_EMAIL_PASSWORD_LOGIN: bool = Field(
|
ENABLE_EMAIL_PASSWORD_LOGIN: bool = Field(
|
||||||
description="whether to enable email password login",
|
description="whether to enable email password login",
|
||||||
@ -619,7 +619,7 @@ class LoginConfig(BaseSettings):
|
|||||||
)
|
)
|
||||||
ENABLE_SOCIAL_OAUTH_LOGIN: bool = Field(
|
ENABLE_SOCIAL_OAUTH_LOGIN: bool = Field(
|
||||||
description="whether to enable github/google oauth login",
|
description="whether to enable github/google oauth login",
|
||||||
default=True,
|
default=False,
|
||||||
)
|
)
|
||||||
EMAIL_CODE_LOGIN_TOKEN_EXPIRY_HOURS: PositiveFloat = Field(
|
EMAIL_CODE_LOGIN_TOKEN_EXPIRY_HOURS: PositiveFloat = Field(
|
||||||
description="expiry time in hours for email code login token",
|
description="expiry time in hours for email code login token",
|
||||||
|
@ -42,11 +42,11 @@ class SystemFeatureModel(BaseModel):
|
|||||||
sso_enforced_for_web: bool = False
|
sso_enforced_for_web: bool = False
|
||||||
sso_enforced_for_web_protocol: str = ""
|
sso_enforced_for_web_protocol: str = ""
|
||||||
enable_web_sso_switch_component: bool = False
|
enable_web_sso_switch_component: bool = False
|
||||||
enable_email_code_login: bool = dify_config.ENABLE_EMAIL_CODE_LOGIN
|
enable_email_code_login: bool = False
|
||||||
enable_email_password_login: bool = dify_config.ENABLE_EMAIL_PASSWORD_LOGIN
|
enable_email_password_login: bool = True
|
||||||
enable_social_oauth_login: bool = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN
|
enable_social_oauth_login: bool = False
|
||||||
is_allow_register: bool = dify_config.ALLOW_REGISTER
|
is_allow_register: bool = True
|
||||||
is_allow_create_workspace: bool = dify_config.ALLOW_CREATE_WORKSPACE
|
is_allow_create_workspace: bool = True
|
||||||
|
|
||||||
|
|
||||||
class FeatureService:
|
class FeatureService:
|
||||||
@ -65,12 +65,22 @@ class FeatureService:
|
|||||||
def get_system_features(cls) -> SystemFeatureModel:
|
def get_system_features(cls) -> SystemFeatureModel:
|
||||||
system_features = SystemFeatureModel()
|
system_features = SystemFeatureModel()
|
||||||
|
|
||||||
|
cls.__fulfill_login_params_from_env(system_features)
|
||||||
|
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
system_features.enable_web_sso_switch_component = True
|
system_features.enable_web_sso_switch_component = True
|
||||||
cls._fulfill_params_from_enterprise(system_features)
|
cls._fulfill_params_from_enterprise(system_features)
|
||||||
|
|
||||||
return system_features
|
return system_features
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __fulfill_login_params_from_env(cls, features: FeatureModel):
|
||||||
|
features.enable_email_code_login = dify_config.ENABLE_EMAIL_CODE_LOGIN
|
||||||
|
features.enable_email_password_login = dify_config.ENABLE_EMAIL_PASSWORD_LOGIN
|
||||||
|
features.enable_social_oauth_login = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN
|
||||||
|
features.is_allow_register = dify_config.ALLOW_REGISTER
|
||||||
|
features.is_allow_create_workspace = dify_config.ALLOW_CREATE_WORKSPACE
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _fulfill_params_from_env(cls, features: FeatureModel):
|
def _fulfill_params_from_env(cls, features: FeatureModel):
|
||||||
features.can_replace_logo = dify_config.CAN_REPLACE_LOGO
|
features.can_replace_logo = dify_config.CAN_REPLACE_LOGO
|
||||||
|
Loading…
Reference in New Issue
Block a user