Code Monkey home page Code Monkey logo

vault_config_provider's Introduction

VaultConfigProvider

Hex.pm Version

VaultConfigProvider is an Elixir Distillery release config provider for loading secrets from Vault into app env at runtime.

Built with Distillery and Vaultex

Installation

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

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

Set up Distillery and add to config provider to the config_providers in rel/config.exs.

  set config_providers: [
    {Mix.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/config.exs"]},
    {VaultConfigProvider, []}
  ]

Configuration

Read the Vaultex docs, and configure vaultex with your vault address and credentials. The Vault address can be set from the system environment or application environment.

VaultConfigProvider assumes vault auth credentials are already set in application environment by earlier config providers.

For instance, the standard Mix.Releases.Config.Providers.Elixir should be configured something like so:

config :vaultex,
  auth: {:kubernetes, %{jwt: File.read!("/tmp/token"), role: "my_role"}},
  vault_addr: "http://127.0.0.1"

config :vaultex,
  auth: {:token, {"root"}}

Usage

The provider will resolve secrets stored matching two patterns srtings or keyword lists. Keyword lists can contain transformations

config :my_app,
  username: "secret:secret/services/my_app key=username",

  username: [
    path: "secret/services/my_app",
    key: "username",
    fun: &transform/1
  ],

A string address is expected to include secret:/path and key=key_name.

A keyword address must contain the keys key and path it also accepts an optional fun argument which can be used for transformations on returned values.

vault_config_provider's People

Contributors

gerbal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.