HitPay.Config (hit_pay v0.2.3)

Utility that handles interaction with the application's configuration

Link to this section Summary

Functions

In config.exs, use a string, a function or a tuple

If there's no environment config, detect based on environment. sandbox is used for non-production environment. In config.exs, use a string, a function or a tuple. Possible environments are "sandbox", "staging", "production"

In config.exs your implicit or expicit configuration is

Resolves the given key from the application's configuration returning the wrapped expanded value. If the value was a function it get's evaluated, if the value is a touple of three elements it gets applied.

In config.exs, use a string, a function or a tuple

Link to this section Functions

In config.exs, use a string, a function or a tuple:

config :hit_pay, api_key: System.get_env("HIT_PAY_API_KEY")

or:

config :hit_pay, api_key: {:system, "HIT_PAY_API_KEY"}

or:

config :hit_pay, api_key: {MyApp.Config, :hit_pay_api_key, []}

If there's no environment config, detect based on environment. sandbox is used for non-production environment. In config.exs, use a string, a function or a tuple. Possible environments are "sandbox", "staging", "production"

config :hit_pay, environment: "sandbox"

or:

config :hit_pay, environment: System.get_env("HIT_PAY_ENVIRONMENT")

or:

config :hit_pay, environment: {:system, "HIT_PAY_ENVIRONMENT"}

or:

config :hit_pay, environment: {MyApp.Config, :HIT_PAY_ENVIRONMENT, []}

Specs

json_library() :: module()

In config.exs your implicit or expicit configuration is:

config ex_:crowdin, json_library: Poison # defaults to Jason but can be configured to Poison
Link to this function

resolve(key, default \\ nil)

Specs

resolve(atom(), any()) :: any()

Resolves the given key from the application's configuration returning the wrapped expanded value. If the value was a function it get's evaluated, if the value is a touple of three elements it gets applied.

In config.exs, use a string, a function or a tuple:

config :hit_pay, salt: System.get_env("HIT_PAY_SALT")

or:

config :hit_pay, salt: {:system, "HIT_PAY_SALT"}

or:

config :hit_pay, salt: {MyApp.Config, :HIT_PAY_SALT, []}