Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.21 KB

README.md

File metadata and controls

54 lines (41 loc) · 1.21 KB

JsonConfix

JsonConfix provides a Distillery release config provider that replaces config tuples (e.g {:json, value}) with values read from a JSON file.

Most of the code has been taken from ConfigTuples

Installation

If available in Hex, the package can be installed by adding json_confix to your list of dependencies in mix.exs:

def deps do
  [
    {:json_confix, "~> 0.2.0"}
  ]
end

Usage

If your JSON file with the configuration is like this

// /path/to/my/secrets.json

{
  "noise": {
    ...
  },
  "secrets": {
    "data": {
      "MY_SECRET": "***************",
      "ANOTHER_SECRET": "**************"
    }
  },
  "more_noise": {
    ...
  }
}

Your configuration should look like:

config :json_confix,
  file_path: "/path/to/my/secrets.json"  # Defaults to /tmp/json_confix.json,
  json_keys: ["secrets", "data"]

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/json_confix.