Wrapper for Mozilla's sops tool to work with encrypted configs and render them into a classic `.env` format
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
485 B
17 lines
485 B
from pprint import pprint
|
|
import os
|
|
|
|
class Env:
|
|
|
|
def __init__(self, transform_config):
|
|
self.config = transform_config
|
|
|
|
def transform(self, config, vault):
|
|
out = []
|
|
for k in self.config["fields"].keys():
|
|
value = vault.resolve(config, self.config["fields"][k])
|
|
if value is None:
|
|
out.append('# ' + k + '=null')
|
|
else:
|
|
out.append(k + '="' + value + '"')
|
|
return os.linesep.join(out)
|
|
|