I’m just wondering if anyone knows if there’s an equivalent approach / library in Elixir to credentials that came out in Rails 5.2
I dismissed it at first but since I’ve been battling with Ansible and setting tonnes of environment variables by using ansible-vault edit ... on a project I’ve realised it’s quite cool. It means I don’t really need the indirection and complexity that Ansible brings to just changing a few configuration variables.
If you’ve no idea what it is it’s just an encrypted yaml file. Your encrypted yaml can be checked into your repo as it’s encrypted, so deploying configs is suddenly easy.
You edit config/credentials.yml.enc with rails credentials:edit which decrypts the file and let’s you change the config vars and carry on. I like the idea of being able to do this in Elixir apps too. Is there anything out there or is this a terrible idea?
I like this idea. I think it shouldn’t be too difficult to implement with elixir … If you use distillery, you would probably copy the encrypted config into release’s priv/ and decrypt / read it into memory during application’s startup hooks. Then in each of your apps’ init callbacks you would have access to the decrypted config.
Hello everyone Rails 5.2 introduced a new feature called Credentials and I think that is a good feature for Phoenix (or elixir) sometimes we have a build server and prod server in build server we need environment variables to build a project with Distillery, the point is that’s not easy to change environment variables to each project pipeline and usually we use (puppet, chef, etc) for that things. I’ll be very happy if have a possibility to add the project credentials together with the project (encrypted). To learn more about credentials.
defmodule MyApp do
use Application
def start(_type, _args) do
# Replace Application environment with resolved values
Confex.resolve_env!(:credentials)
# ...
end
end
This way you will be able to access your configs via the usual Application.get_env(:credentials, :username)