Skip to content

Add helpful string/byte wrappers for secrets and external data#188

Open
TheJokr wants to merge 2 commits intomainfrom
lblocher/settings-secret
Open

Add helpful string/byte wrappers for secrets and external data#188
TheJokr wants to merge 2 commits intomainfrom
lblocher/settings-secret

Conversation

@TheJokr
Copy link
Copy Markdown
Collaborator

@TheJokr TheJokr commented Apr 2, 2026

The Secret and RawSecret types help with keeping data from being leaked accidentally in a program, for example via fmt::Debug and fmt::Display. Additionally, they always zero their memory on drop. (The latter is best effort, since the underlying types can reallocate.)

MaybeExternal is an enum to load a String/Bytes/Secret/RawSecret value either inline (from the config file itself) or from an external source (environment variables or file system). This is especially useful for containerized applications, where config is routinely split between many files or injected via environment variables. The source is selected in the main config file.

@TheJokr TheJokr requested a review from fisherdarling April 2, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant