Using secrets
Universal example
import toml
_decrypted_toml = # decrypt a file using your method of choice
secrets = toml.loads(_decrypted_toml)
# ...root_password_hash = secrets["desktops"]["root_password_hash"]Example: Using age or gpg
age or gpgimport toml, subprocess
with open("secrets.toml.age", "rb") as f:
_decrypted_toml = subprocess.run(["age", "--decrypt"], input=f.read(), stdout=subprocess.PIPE, check=True).stdout.decode()
secrets = toml.loads(_decrypted_toml)import toml, subprocess
with open("secrets.toml.gpg", "rb") as f:
_decrypted_toml = subprocess.run(["gpg", "--quiet", "--decrypt"], input=f.read(), stdout=subprocess.PIPE, check=True).stdout.decode()
secrets = toml.loads(_decrypted_toml)
# ...[desktops]
root_password_hash = "$6$3gtzs4..."Last updated