Skip to content

Crowd library: Load configuration from JSON files for Elixir apps

Notifications You must be signed in to change notification settings

trax-retail/json_confix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Crowd library: Load configuration from JSON files for Elixir apps

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages