Skip to content
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

add FileSystem provider #11

Merged
merged 3 commits into from
Dec 26, 2024
Merged

Conversation

jramos
Copy link
Contributor

@jramos jramos commented Nov 21, 2024

This allows for secrets to be read from a local file system, e.g. those mounted via the Kubernetes Secrets Store CSI Driver.

@jramos
Copy link
Contributor Author

jramos commented Nov 21, 2024

This may actually work better as a stand-alone provider so that default search paths can be configured to make the keys less verbose. Wdyt?

@gordalina
Copy link
Owner

Thanks for contributing! I think this is a great native provider. What do you mean about the default search paths?

@jramos
Copy link
Contributor Author

jramos commented Nov 23, 2024

It would be something like this...

config :hush,
  file_system_provider: [
    root_path: "/opt/thenameofyourcompany/secrets"
  ]

config :app, App,
  ssl_certificate: {:hush, FileSystem, "cert.pem"}

config :app, App.Other,
  ssl_key: {:hush, FileSystem, "private/cert.pem"}

That way "/opt/thenameofyourcompany/secrets" isn't needed in every key, and it would prevent arbitrary paths from being used... all the keys would need to be nested under the configured root_path.

The "search path" idea is similar, but you would have a list of paths, and the directories would be checked in order for the file until one was found.

config :hush,
  file_system_provider: [
    search_paths: [
      "/opt/thenameofyourcompany/secrets",
      "/opt/secrets",
      "/etc/app"
    ]
  ]

@gordalina
Copy link
Owner

Added a commit, lmk what you think.

@gordalina gordalina force-pushed the jr-filesystem-provider branch 4 times, most recently from 98dc671 to 8dfac02 Compare November 28, 2024 06:30
@gordalina gordalina force-pushed the jr-filesystem-provider branch from 7c83ced to 2fdb5dd Compare November 28, 2024 08:26
@jramos
Copy link
Contributor Author

jramos commented Nov 29, 2024

Looks great to me!

@gordalina gordalina merged commit d23b8b5 into gordalina:main Dec 26, 2024
9 checks passed
@gordalina
Copy link
Owner

Released in v1.2.0 thanks!

@jramos jramos deleted the jr-filesystem-provider branch December 26, 2024 20:43
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.

2 participants