Switched to HVAC Agent instead of connecting to the vault directly
This commit is contained in:
parent
d356ec8428
commit
f67fd99333
@ -1,18 +1,14 @@
|
|||||||
import base64
|
|
||||||
import hvac
|
import hvac
|
||||||
|
import base64
|
||||||
|
import os
|
||||||
|
|
||||||
|
HVAC_AGENT_URL = os.getenv("HVAC_AGENT_URL","http://vault-agent:8201")
|
||||||
client = hvac.Client(
|
client = hvac.Client(url=HVAC_AGENT_URL)
|
||||||
url='http://127.0.0.1:8200',
|
|
||||||
token='root'
|
|
||||||
)
|
|
||||||
|
|
||||||
def decrypt_token(ciphertext: str) -> str:
|
def decrypt_token(ciphertext: str) -> str:
|
||||||
response = client.secrets.transit.decrypt_data(
|
response = client.secrets.transit.decrypt_data(
|
||||||
name='push-tokens',
|
name="push-tokens",
|
||||||
ciphertext=ciphertext
|
ciphertext=ciphertext
|
||||||
)
|
)
|
||||||
plaintext_b64 = response['data']['plaintext']
|
plaintext_b64 = response["data"]["plaintext"]
|
||||||
return base64.b64decode(plaintext_b64).decode()
|
return base64.b64decode(plaintext_b64).decode()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user