Skip to content

drselump14/sops_config_provider

Repository files navigation

SopsConfigProvider

Decrypt secrets from sops file and set the config to your application on runtime.

Installation

The package can be installed by adding sops_config_provider to your list of dependencies in mix.exs:

def deps do
  [
    {:sops_config_provider, "~> 0.1.0"}
  ]
end

Usage

[ATTENTION] Please make sure that you have sops installed, and proper permission to encrypt and decrypt the file. See SOPS docs for sops intallation and setup

After the installation, you need to add the provider into def project section in mix.exs.

      releases: [
        change_with_your_app_name: [
          config_providers: [
            {
              SopsConfigProvider,
              %{
                app_name: :change_with_your_app_name,
                secret_file_path: "priv/secrets.yml" # I'd recommend to put
                # the secrets inside the priv directory, as it automatically get
                # copied on release
              }
            }
          ]
        ]
      ]

The config provider will decrypt the secrets and set the config like you do in runtime.exs

For example, if you have secrets config in yaml as below

# priv/secrets.yml
sentry:
    dsn: "https://sentry.io"

It'll set the value below and app boot like on runtime.exs

config :sentry, dsn: "http://sentry.io"

About

sops_config_provider

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages