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