Skip to content

Commit

Permalink
feat(default.py): add ENABLE_MULTI_TENANT_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
wklken committed Dec 2, 2024
1 parent 8c28cda commit 59f031f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/dashboard/apigateway/apigateway/conf/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
# 是否为本地开发环境
IS_LOCAL = env.bool("DASHBOARD_IS_LOCAL", default=False)

# 是否开启多租户模式
ENABLE_MULTI_TENANT_MODE = env.bool("ENABLE_MULTI_TENANT_MODE", default=False)

ALLOWED_HOSTS = ["*"]

# Application definition
Expand Down
17 changes: 10 additions & 7 deletions src/dashboard/bin/on_migrate
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ python manage.py sync_default_micro_gateway \
--secret "${DEFAULT_MICRO_GATEWAY_SECRET}" \
--http-url "${DEFAULT_MICRO_GATEWAY_HTTP_URL}"

# ESB 相关
python manage.py create_esb_jwt_key
python manage.py create_esb_gateway
python manage.py sync_esb_jwt_key_to_gateway
python manage.py update_esb_user_verified_unrequired_apps ${esb_verified_user_exempted_apps}
python manage.py sync_esb_verified_user_exempted_apps_to_gateway
python manage.py add_plugin_error_status_code_200
# only init esb when ENABLE_MULTI_TENANT_MODE != true/True
if [ "${ENABLE_MULTI_TENANT_MODE}" != "true" ] && [ "${ENABLE_MULTI_TENANT_MODE}" != "True" ]; then
# ESB 相关
python manage.py create_esb_jwt_key
python manage.py create_esb_gateway
python manage.py sync_esb_jwt_key_to_gateway
python manage.py update_esb_user_verified_unrequired_apps ${esb_verified_user_exempted_apps}
python manage.py sync_esb_verified_user_exempted_apps_to_gateway
python manage.py add_plugin_error_status_code_200
fi

# 蓝鲸通知中心
python manage.py register_to_bk_notice
7 changes: 6 additions & 1 deletion src/dashboard/bin/post_migrate
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ sync_bk_default() {
# 默认共享网关实例挂在 bk-default 这个网关中,所以 sync_bk_default 必须在第一位
sync_bk_default
sync_bk_apigateway
sync_bk_esb

# only init esb when ENABLE_MULTI_TENANT_MODE != true/True
if [ "${ENABLE_MULTI_TENANT_MODE}" != "true" ] && [ "${ENABLE_MULTI_TENANT_MODE}" != "True" ]; then
sync_bk_esb
fi

sync_bk_apigateway_inner

# delete abandoned celery tasks in 1.14(remove below code in 1.15)
Expand Down

0 comments on commit 59f031f

Please sign in to comment.