feat: 增加Vault客户端认证及switchBundle状态检查
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import hvac
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
exit()
|
exit()
|
||||||
@@ -11,6 +12,30 @@ ProjDir = sys.argv[1]
|
|||||||
BuildDir = ProjDir + '\\build\\web-mobile\\'
|
BuildDir = ProjDir + '\\build\\web-mobile\\'
|
||||||
SubgamePath = 's3://web-h5game-test/internal/'
|
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 = {
|
BundleConfig = {
|
||||||
'6001': 'whot',
|
'6001': 'whot',
|
||||||
'6002': 'whot',
|
'6002': 'whot',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import hvac
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
exit()
|
exit()
|
||||||
@@ -11,6 +12,31 @@ ProjDir = sys.argv[1]
|
|||||||
BuildDir = ProjDir + '\\build\\web-mobile\\'
|
BuildDir = ProjDir + '\\build\\web-mobile\\'
|
||||||
SubgamePath = 's3://web-h5game-prod/internal/'
|
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 = {
|
BundleConfig = {
|
||||||
'6001': 'whot',
|
'6001': 'whot',
|
||||||
'6002': 'whot',
|
'6002': 'whot',
|
||||||
|
|||||||
Reference in New Issue
Block a user