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

Accepting function as key configuration #112

Closed
michelboaventura opened this issue Feb 25, 2022 · 1 comment
Closed

Accepting function as key configuration #112

michelboaventura opened this issue Feb 25, 2022 · 1 comment

Comments

@michelboaventura
Copy link

Hey,

I'm using cloak/cloak_ecto and everything works great, thanks for the excellent project!

I'm thinking about accepting a function as value for the key configuration, so that it's easier to use env vars as keys without having to implement the init callback on Vault.

It'd be something like:

config :my_app, MyApp.Vault,
  ciphers: [
    default: {
      Cloak.Ciphers.AES.GCM,
      tag: "AES.GCM.V1", key: fn -> Base.decode64!(System.get_env("SOME_ENV")) end, iv_length: 12
    }
  ]

What do you think? I'm willing to create a PR if you think it's a good idea.

@michelboaventura
Copy link
Author

Hey,

I've find out we can't use functions within release config files, so this wouldn't work. Sorry about that!

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

No branches or pull requests

1 participant