Skip to content

armgit / dify

Public Imported from GitHub
0

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.

feat: configurable invite expiry time (#1573)

Matrid0456d0f42b7
diff --git a/api/config.py b/api/config.py
index 2d6a9d5aac7..f6e7fa67cab 100644
--- a/api/config.py
+++ b/api/config.py
@@ -60,7 +60,8 @@ DEFAULTS = {
'UPLOAD_FILE_BATCH_LIMIT': 5,
'UPLOAD_IMAGE_FILE_SIZE_LIMIT': 10,
'OUTPUT_MODERATION_BUFFER_SIZE': 300,
- 'MULTIMODAL_SEND_IMAGE_FORMAT': 'base64'
+ 'MULTIMODAL_SEND_IMAGE_FORMAT': 'base64',
+ 'INVITE_EXPIRY_HOURS': 72
}
@@ -218,6 +219,11 @@ class Config:
self.MAIL_TYPE = get_env('MAIL_TYPE')
self.MAIL_DEFAULT_SEND_FROM = get_env('MAIL_DEFAULT_SEND_FROM')
self.RESEND_API_KEY = get_env('RESEND_API_KEY')
+
+ # ------------------------
+ # Workpace Configurations.
+ # ------------------------
+ self.INVITE_EXPIRY_HOURS = int(get_env('INVITE_EXPIRY_HOURS'))
# ------------------------
# Sentry Configurations.
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 58c315c4249..c1f5dcdc1bd 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -489,9 +489,10 @@ class RegisterService:
'email': account.email,
'workspace_id': tenant.id,
}
+ expiryHours = current_app.config['INVITE_EXPIRY_HOURS']
redis_client.setex(
cls._get_invitation_token_key(token),
- 3600,
+ expiryHours * 60 * 60,
json.dumps(invitation_data)
)
return token