some optimization for admin api key, create tenant and reset-encrypt-key-pair command (#3013)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong
2024-03-28 17:02:52 +08:00
committed by GitHub
parent b0b0cc045f
commit 669c8c3cca
3 changed files with 17 additions and 17 deletions

View File

@@ -53,7 +53,7 @@ def login_required(func):
def decorated_view(*args, **kwargs):
auth_header = request.headers.get('Authorization')
admin_api_key_enable = os.getenv('ADMIN_API_KEY_ENABLE', default='False')
if admin_api_key_enable:
if admin_api_key_enable.lower() == 'true':
if auth_header:
if ' ' not in auth_header:
raise Unauthorized('Invalid Authorization header format. Expected \'Bearer <api-key>\' format.')