Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: support configuration of refresh token expiration by environment variable (#12335)
eux1fa66405c5e8
diff --git a/api/.env.example b/api/.env.exampleindex cc3e868717e..95da531a1d6 100644--- a/api/.env.example+++ b/api/.env.example@@ -23,6 +23,9 @@ FILES_ACCESS_TIMEOUT=300# Access token expiration time in minutesACCESS_TOKEN_EXPIRE_MINUTES=60+# Refresh token expiration time in days+REFRESH_TOKEN_EXPIRE_DAYS=30+# celery configurationCELERY_BROKER_URL=redis://:difyai123456@localhost:6379/1diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.pyindex 1550de0fd24..59309fd25cb 100644--- a/api/configs/feature/__init__.py+++ b/api/configs/feature/__init__.py@@ -488,6 +488,11 @@ class AuthConfig(BaseSettings):default=60,)+ REFRESH_TOKEN_EXPIRE_DAYS: PositiveFloat = Field(+ description="Expiration time for refresh tokens in days",+ default=30,+ )+LOGIN_LOCKOUT_DURATION: PositiveInt = Field(description="Time (in seconds) a user must wait before retrying login after exceeding the rate limit.",default=86400,diff --git a/api/services/account_service.py b/api/services/account_service.pyindex 64477480dbe..dd1cc5f94f4 100644--- a/api/services/account_service.py+++ b/api/services/account_service.py@@ -65,7 +65,7 @@ class TokenPair(BaseModel):REFRESH_TOKEN_PREFIX = "refresh_token:"ACCOUNT_REFRESH_TOKEN_PREFIX = "account_refresh_token:"-REFRESH_TOKEN_EXPIRY = timedelta(days=30)+REFRESH_TOKEN_EXPIRY = timedelta(days=dify_config.REFRESH_TOKEN_EXPIRE_DAYS)class AccountService:diff --git a/docker/.env.example b/docker/.env.exampleindex 50ba856bd3c..2b296e80662 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -105,6 +105,9 @@ FILES_ACCESS_TIMEOUT=300# Access token expiration time in minutesACCESS_TOKEN_EXPIRE_MINUTES=60+# Refresh token expiration time in days+REFRESH_TOKEN_EXPIRE_DAYS=30+# The maximum number of active requests for the application, where 0 means unlimited, should be a non-negative integer.APP_MAX_ACTIVE_REQUESTS=0APP_MAX_EXECUTION_TIME=1200diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex b82659d959f..0c5d7e7ae83 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -27,6 +27,7 @@ x-shared-env: &shared-api-worker-envMIGRATION_ENABLED: ${MIGRATION_ENABLED:-true}FILES_ACCESS_TIMEOUT: ${FILES_ACCESS_TIMEOUT:-300}ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES:-60}+ REFRESH_TOKEN_EXPIRE_DAYS: ${REFRESH_TOKEN_EXPIRE_DAYS:-30}APP_MAX_ACTIVE_REQUESTS: ${APP_MAX_ACTIVE_REQUESTS:-0}APP_MAX_EXECUTION_TIME: ${APP_MAX_EXECUTION_TIME:-1200}DIFY_BIND_ADDRESS: ${DIFY_BIND_ADDRESS:-0.0.0.0}