Skip to content

A simple configuration manager for namespaced modules in Elixr.

License

Notifications You must be signed in to change notification settings

suitepad-gmbh/get_conf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GetConf

A simple configuration manager for namespaced modules.

Installation

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

{:get_conf, "~> 0.1.0"},

Usage

Define your configuration in your config/{env}.exs:

use Mix.Config

config :app_name, AppName, key: "value"

And access it in your modules. It will go further up the namespace, to find a matching key in the configuration of each module.

GetConf.get_conf(:app_name, AppName, :key)
# => "value"

GetConf.get_conf(:app_name, AppName.Module, :key)
# => "value"

Macro

You can also use the GetConf module inside your module, to implement get_conf/1 and set_conf/2.

defmodule TestModule
  use GetConf, otp_app: :app_name
end

"bar" = TestModule.get_conf(:foo)

Documentation

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

About

A simple configuration manager for namespaced modules in Elixr.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages