feat: 增加Vault客户端认证及switchBundle状态检查

This commit is contained in:
Kirito
2026-01-29 19:03:20 +08:00
parent bb573cc0c1
commit 45d743e78e
2 changed files with 51 additions and 0 deletions

View File

@@ -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',