Skip to content

Commit

Permalink
fix(backend): fix RUN_VER ERROR #1914
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Nov 18, 2023
1 parent 5853e4e commit 04722a2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions dbm-ui/backend/components/bklog/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from ... import env
from ..base import DataAPI
from ..domains import BKLOG_APIGW_DOMAIN

Expand All @@ -29,15 +30,15 @@ def __init__(self):
self.fast_create = DataAPI(
method="POST",
base=BKLOG_APIGW_DOMAIN,
url="databus/collectors/fast_create/" if settings.RUN_VER == "open" else "databus_collectors/fast_create/",
url="databus/collectors/fast_create/" if env.RUN_VER == "open" else "databus_collectors/fast_create/",
module=self.MODULE,
description=_("简易创建采集配置"),
)
self.fast_update = DataAPI(
method="POST",
base=BKLOG_APIGW_DOMAIN,
url="databus/collectors/{collector_config_id}/fast_update/"
if settings.RUN_VER == "open"
if env.RUN_VER == "open"
else "/databus_collectors/{collector_config_id}/fast_update/",
module=self.MODULE,
description=_("简易更新采集配置"),
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/components/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
DRS_APIGW_DOMAIN = env.DRS_APIGW_DOMAIN or APIGW_DOMAIN_PREFIX_FORMAT.format("db_remove_service")
# 监控区分上云版和社区版环境,待统一
BKMONITORV3_APIGW_DOMAIN = env.BKMONITORV3_APIGW_DOMAIN or APIGW_DOMAIN_PREFIX_FORMAT.format(
"monitor_v3" if settings.RUN_VER == "open" else "bkmonitorv3"
"monitor_v3" if env.RUN_VER == "open" else "bkmonitorv3"
)
MYSQL_SIMULATION_DOMAIN = env.MYSQL_SIMULATION_DOMAIN or APIGW_DOMAIN_PREFIX_FORMAT.format("db_simulation")
NAMESERVICE_APIGW_DOMAIN = env.NAMESERVICE_APIGW_DOMAIN or APIGW_DOMAIN_PREFIX_FORMAT.format("nameservice")
Expand Down
4 changes: 3 additions & 1 deletion dbm-ui/backend/dbm_init/medium/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from bkstorages.backends.bkrepo import TIMEOUT_THRESHOLD, BKGenericRepoClient, BKRepoStorage, urljoin
from django.conf import settings

from backend import env

logger = logging.getLogger("root")


Expand Down Expand Up @@ -126,7 +128,7 @@ def upload_medium(self, path, bkrepo_tmp_dir):
for file in files:
if "?" in file:
continue
if settings.RUN_VER == "ieod" and "dbbackup-go" in file:
if env.RUN_VER == "ieod" and "dbbackup-go" in file:
# 内部版本不自动上传 dbbackup
continue

Expand Down
2 changes: 2 additions & 0 deletions dbm-ui/backend/env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
SECRET_KEY = get_type_env(key="APP_TOKEN", default="yb2gur=g)hxbmpk3#b%ez5_#6o!tf9vkqsnwo4dxyr0n&w3=9k", _type=str)
DEFAULT_USERNAME = get_type_env(key="DEFAULT_USERNAME", default="admin", _type=str)

RUN_VER = get_type_env(key="RUN_VER", default="open", _type=str)

# Redis 配置
REDIS_HOST = get_type_env(key="REDIS_HOST", _type=str, default="localhost")
REDIS_PORT = get_type_env(key="REDIS_PORT", _type=int, default=6379)
Expand Down
9 changes: 4 additions & 5 deletions dbm-ui/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
from datetime import timedelta
from pathlib import Path
from typing import Dict

import pymysql
from blueapps.conf.default_settings import * # pylint: disable=wildcard-import
from celery.schedules import crontab
from blueapps.core.celery.celery import app
from config import RUN_VER

if RUN_VER == "open":
from backend import env

if env.RUN_VER == "open":
from blueapps.patch.settings_open_saas import * # pylint: disable=wildcard-import
else:
from blueapps.patch.settings_paas_services import * # pylint: disable=wildcard-import
Expand Down Expand Up @@ -215,7 +214,7 @@

DJANGO_REDIS_CONNECTION_FACTORY = "backend.utils.redis.ConnectionFactory"

RUN_VER = os.getenv("RUN_VER", "open")
RUN_VER = env.RUN_VER
BK_PAAS_HOST = os.getenv("BK_PAAS_HOST", "")

# IAM Settings
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/bk-dbm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ dependencies:
description: A Helm chart for bkdbm
name: bk-dbm
type: application
version: 1.2.0-alpha.91
appVersion: 1.2.0-alpha.91
version: 1.2.0-alpha.92
appVersion: 1.2.0-alpha.92
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/dbm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.2.0-alpha.509
appVersion: 1.2.0-alpha.510
description: A Helm chart for dbm
name: dbm
type: application
Expand Down

0 comments on commit 04722a2

Please sign in to comment.