Using Secrets in pyinfra¶
Encrypting sensitive information can be achieved using Python packages such as privy.
# group_data/all.py
from getpass import getpass
import privy
def get_secret(encrypted_secret):
password = getpass('Please provide the secret password: ')
return privy.peek(encrypted_secret, password)
my_secret = get_secret('encrypted-secret-value')
An alternative might use an environment variable for the password: