refactor(SwitchBundle): 重构h5子游戏拆分上传工具
This commit is contained in:
29
python/vault_options.py
Normal file
29
python/vault_options.py
Normal file
@@ -0,0 +1,29 @@
|
||||
DEFAULT_VAULT_PATH = 'dev'
|
||||
DEFAULT_VAULT_MOUNT_POINT = 'tokens'
|
||||
|
||||
|
||||
def parse_vault_options(argv):
|
||||
"""Return the Vault path and mount point from the script arguments.
|
||||
|
||||
The first two arguments are already used by the publishing scripts for
|
||||
the project directory and access password. Vault settings therefore
|
||||
remain optional arguments 3 and 4 so existing invocations keep working.
|
||||
"""
|
||||
proj = argv[1]
|
||||
pwd = argv[2]
|
||||
env = argv[3]
|
||||
cat = argv[4]
|
||||
path = argv[5] if len(argv) > 5 else DEFAULT_VAULT_PATH
|
||||
mount_point = argv[6] if len(argv) > 6 else DEFAULT_VAULT_MOUNT_POINT
|
||||
return proj, pwd, env, cat, path, mount_point
|
||||
|
||||
|
||||
def read_switch_bundle(
|
||||
client,
|
||||
path=DEFAULT_VAULT_PATH,
|
||||
mount_point=DEFAULT_VAULT_MOUNT_POINT):
|
||||
return client.secrets.kv.v2.read_secret_version(
|
||||
path=path,
|
||||
mount_point=mount_point,
|
||||
raise_on_deleted_version=True
|
||||
)
|
||||
Reference in New Issue
Block a user