Skip to content

Commit

Permalink
feature: 统一语言 Cookie (closed #1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
CohleRustW authored and ZhuoZhuoCrayon committed Jul 12, 2023
1 parent 013c4b9 commit ddc9e7f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
from blueapps.account.conf import ConfFixture
from django.conf import settings
from django.utils.translation import ugettext as _
from version_log.utils import get_latest_version

from apps.node_man import constants
from apps.node_man.handlers.iam import IamHandler
from apps.utils.local import get_request_username
from version_log.utils import get_latest_version

"""
context_processor for common(setting)
Expand Down Expand Up @@ -99,4 +99,6 @@ def mysetting(request):
"BKAPP_NAV_OPEN_SOURCE_URL": settings.BKAPP_NAV_OPEN_SOURCE_URL,
# 导航栏技术支持地址
"BKAPP_NAV_HELPER_URL": settings.BKAPP_NAV_HELPER_URL,
"BK_DOMAIN": settings.BK_DOMAIN,
"BK_COMPONENT_API_URL": settings.BK_COMPONENT_API_OUTER_URL,
}
2 changes: 2 additions & 0 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@
# ESB、APIGW 的域名,新增于PaaSV3,如果取不到该值,则使用 BK_PAAS_INNER_HOST
# OVERWRITE 区分,BK_COMPONENT_API_URL 会被开发框架覆盖导致 PaaSV2 环境下为 None
BK_COMPONENT_API_OVERWRITE_URL = env.BK_COMPONENT_API_URL
BK_COMPONENT_API_OUTER_URL = env.BK_COMPONENT_API_OUTER_URL
BK_APIGW_NAME = "bk-nodeman"
BK_API_URL_TMPL = env.BK_API_URL_TMPL
BK_DOMAIN = env.BK_DOMAIN

BK_NODEMAN_HOST = env.BK_NODEMAN_HOST
# 节点管理后台外网域名,用于构造文件导入导出的API URL
Expand Down
11 changes: 11 additions & 0 deletions env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"BKPAAS_MAJOR_VERSION",
# esb 访问地址
"BK_COMPONENT_API_URL",
# esb 访问外网地址
"BK_COMPONENT_API_OUTER_URL",
# 节点管理SaaS访问地址
"BK_NODEMAN_HOST",
# 节点管理后台访问地址
Expand All @@ -44,6 +46,7 @@
"BK_IAM_SAAS_HOST",
# 提供给权限中心的资源回调地址
"BK_IAM_RESOURCE_API_HOST",
"BK_DOMAIN",
]

# ===============================================================================
Expand Down Expand Up @@ -111,6 +114,14 @@
# APIGW API 地址模板,在 PaaS 3.0 部署的应用,可从环境变量中获取 BK_API_URL_TMPL
BK_API_URL_TMPL = get_type_env(key="BK_API_URL_TMPL", default=BK_COMPONENT_API_URL + "/api/{api_name}", _type=str)

# esb 外网域名, Helm 部署时从环境变量中获取 BK_PAAS_OUTER_HOST , 二进制部署时使用 BK_PAAS_HOST
BK_COMPONENT_API_OUTER_URL = get_type_env(key="BK_PAAS_OUTER_HOST", default="", _type=str) or get_type_env(
key="BK_PAAS_HOST", default=BK_COMPONENT_API_URL, _type=str
)

# 蓝鲸根域名
BK_DOMAIN = get_type_env(key="BK_DOMAIN", default="", _type=str)

# 导航栏开源社区地址
BKAPP_NAV_OPEN_SOURCE_URL = get_type_env(
key="BKAPP_NAV_OPEN_SOURCE_URL", default="https://github.com/TencentBlueKing/bk-nodeman", _type=str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ data:
BK_LOGIN_URL: "{{ .Values.bkLoginUrl }}"

BK_PAAS_INNER_HOST: "{{ .Values.bkComponentApiUrl }}"
BK_PAAS_OUTER_HOST: "{{ .Values.bkComponentApiUrl }}"
{{- if .Values.config.bkAppBkNodeApiGateway }}
BKAPP_BK_NODE_APIGATEWAY: "{{ .Values.config.bkAppBkNodeApiGateway }}/"
{{- end }}
Expand Down Expand Up @@ -104,4 +105,5 @@ data:

BKAPP_NAV_OPEN_SOURCE_URL: "{{ .Values.config.bkAppNavOpenSourceUrl }}"
BKAPP_NAV_HELPER_URL: "{{ .Values.config.bkAppNavHelperUrl }}"
BK_DOMAIN: "{{ .Values.global.bkDomain }}"

0 comments on commit ddc9e7f

Please sign in to comment.