From 45d743e78e39f196f937a392be0c41602d8ac727 Mon Sep 17 00:00:00 2001 From: Kirito Date: Thu, 29 Jan 2026 19:03:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0Vault=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E8=AE=A4=E8=AF=81=E5=8F=8AswitchBundle?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/switchBundle.py | 25 +++++++++++++++++++++++++ python/switchBundleR.py | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/python/switchBundle.py b/python/switchBundle.py index 64f08c1..dab3f00 100644 --- a/python/switchBundle.py +++ b/python/switchBundle.py @@ -1,6 +1,7 @@ import os import sys import subprocess +import hvac if len(sys.argv) < 3: exit() @@ -11,6 +12,30 @@ ProjDir = sys.argv[1] BuildDir = ProjDir + '\\build\\web-mobile\\' SubgamePath = 's3://web-h5game-test/internal/' +# Vault 地址和 Token +VAULT_ADDR = 'https://keys.wehavefun.email' +VAULT_TOKEN = 'hvs.CAESIJNR6tvdIBSvRuI8r_O_82yjqu6eztxKQtk2oEGmOrFSGh4KHGh2cy5KSmlmS2xIbHprcDUwOUlIOVJ3TzdjUWQ' + +# 创建客户端 +client = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN) + +if client.is_authenticated(): + secret = client.secrets.kv.v2.read_secret_version( + path='default', + mount_point='aws', + raise_on_deleted_version=True + ) + SwitchBundle = secret['data']['data']['switchBundle'] + if "1" != SwitchBundle: + print("script exit, switchBundle status is " + SwitchBundle) + exit() +else: + print("running script failed!") + exit() + +print("start running script...") + + BundleConfig = { '6001': 'whot', '6002': 'whot', diff --git a/python/switchBundleR.py b/python/switchBundleR.py index 4e3565d..3e09e32 100644 --- a/python/switchBundleR.py +++ b/python/switchBundleR.py @@ -1,6 +1,7 @@ import os import sys import subprocess +import hvac if len(sys.argv) < 3: exit() @@ -11,6 +12,31 @@ ProjDir = sys.argv[1] BuildDir = ProjDir + '\\build\\web-mobile\\' SubgamePath = 's3://web-h5game-prod/internal/' +# Vault 地址和 Token +VAULT_ADDR = 'https://keys.wehavefun.email' +VAULT_TOKEN = 'hvs.CAESIJNR6tvdIBSvRuI8r_O_82yjqu6eztxKQtk2oEGmOrFSGh4KHGh2cy5KSmlmS2xIbHprcDUwOUlIOVJ3TzdjUWQ' + +# 创建客户端 +client = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN) + +if client.is_authenticated(): + secret = client.secrets.kv.v2.read_secret_version( + path='default', + mount_point='aws', + raise_on_deleted_version=True + ) + SwitchBundle = secret['data']['data']['switchBundle'] + if "1" != SwitchBundle: + print("script exit, switchBundle status is " + SwitchBundle) + exit() +else: + print("running script failed!") + exit() + +print("start running script...") + + + BundleConfig = { '6001': 'whot', '6002': 'whot',