21 lines
646 B
Python
21 lines
646 B
Python
import os
|
|
import hvac
|
|
|
|
def connect_hvac():
|
|
client = hvac.Client(
|
|
url='https://vlt.dataekb.ru:8222',
|
|
token=os.environ.get('VAULT_TOKEN'),
|
|
)
|
|
print(f"Vault URL: {os.getenv('VAULT_ADDR')}")
|
|
print(f"Token exists: {bool(os.getenv('VAULT_TOKEN'))}")
|
|
print(f"Authenticated: {client.is_authenticated()}")
|
|
|
|
read_response = client.secrets.kv.v2.read_secret_version(path='oracledb', mount_point='kv')
|
|
pw = read_response['data']['data']['password']
|
|
un = read_response['data']['data']['user']
|
|
cs = read_response['data']['data']['cs']
|
|
|
|
print(read_response)
|
|
print(pw)
|
|
print(un)
|
|
print(cs) |