refactor(services/tasks): Swtich to dify_config witch Pydantic (#6203)
This commit is contained in:
@@ -6,10 +6,10 @@ from datetime import datetime, timedelta, timezone
|
||||
from hashlib import sha256
|
||||
from typing import Any, Optional
|
||||
|
||||
from flask import current_app
|
||||
from sqlalchemy import func
|
||||
from werkzeug.exceptions import Unauthorized
|
||||
|
||||
from configs import dify_config
|
||||
from constants.languages import language_timezone_mapping, languages
|
||||
from events.tenant_event import tenant_was_created
|
||||
from extensions.ext_redis import redis_client
|
||||
@@ -80,7 +80,7 @@ class AccountService:
|
||||
payload = {
|
||||
"user_id": account.id,
|
||||
"exp": datetime.now(timezone.utc).replace(tzinfo=None) + exp,
|
||||
"iss": current_app.config['EDITION'],
|
||||
"iss": dify_config.EDITION,
|
||||
"sub": 'Console API Passport',
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ class RegisterService:
|
||||
TenantService.create_owner_tenant_if_not_exist(account)
|
||||
|
||||
dify_setup = DifySetup(
|
||||
version=current_app.config['CURRENT_VERSION']
|
||||
version=dify_config.CURRENT_VERSION
|
||||
)
|
||||
db.session.add(dify_setup)
|
||||
db.session.commit()
|
||||
@@ -559,7 +559,7 @@ class RegisterService:
|
||||
|
||||
if open_id is not None or provider is not None:
|
||||
AccountService.link_account_integrate(provider, open_id, account)
|
||||
if current_app.config['EDITION'] != 'SELF_HOSTED':
|
||||
if dify_config.EDITION != 'SELF_HOSTED':
|
||||
tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
|
||||
|
||||
TenantService.create_tenant_member(tenant, account, role='owner')
|
||||
@@ -623,7 +623,7 @@ class RegisterService:
|
||||
'email': account.email,
|
||||
'workspace_id': tenant.id,
|
||||
}
|
||||
expiryHours = current_app.config['INVITE_EXPIRY_HOURS']
|
||||
expiryHours = dify_config.INVITE_EXPIRY_HOURS
|
||||
redis_client.setex(
|
||||
cls._get_invitation_token_key(token),
|
||||
expiryHours * 60 * 60,
|
||||
|
Reference in New Issue
Block a user