-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k8s file-mounted secrets #1092
Labels
Comments
Right now, the easiest path is to create a hook function and attach it as shown here: https://www.dynaconf.com/advanced/?h=hooks#instance-approach import os
def load_mounted_secrets(settings):
data = {"dynaconf_merge": True}
folder_path = "the/path/to/the/secrets" # or take from settings
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
if os.path.isfile(file_path):
with open(file_path, 'r') as file:
data[filename] = file.read().strip()
return data
settings = Dynaconf(post_hooks=[load_mounted_secrets]) It would be great to have this feature built-in in a better standardized way, so A PR also welcome. How I would do it:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In K8S, it is common to mount secrets to a file such as tmpfs.
The typical format puts each secret into a separate file inside a mounted volume, where the key is the filename and the content is the value.
Is there a way to achieve loading this in Dynaconf?
If not, what is the best way to add this functionality (using hooks or plugin, or contribute a PR?).
The text was updated successfully, but these errors were encountered: