Vipex v0.1.0 Vipex View Source

Maps environment variables to configuration options

For best results apply environment configuration at application start

defmodule MyApp.Application do
  use Application

  def start(_type, _args) do
    Vipex.apply_env_config(:my_app)
    Supervisor.start_link([], strategy: :one_for_one)
  end
end

Link to this section Summary

Functions

Applies the environment variables to all loaded applications’ configs

Applies the environment variables to the provided application’s config

Link to this section Functions

Link to this function apply_all_env_config(opts \\ []) View Source
apply_all_env_config(Keyword.t()) :: :ok

Applies the environment variables to all loaded applications’ configs

Link to this function apply_env_config(application, opts \\ []) View Source
apply_env_config(atom(), Keyword.t()) :: :ok

Applies the environment variables to the provided application’s config

If using the default transformers and the following config

config :guardian, Guardian,
  allowed_algos: ["HS256"],
  issuer: "issuer-dev.auth0.com",
  allowed_drift: 2000,
  verify_issuer: false

Then if environment variables were set as follows

System.put_env("GUARDIAN_GUARDIAN_ALLOWED_ALGOS", "[\"RS256\"]")
System.put_env("GUARDIAN_GUARDIAN_ISSUER", "issuer-prod.auth0.com")
System.put_env("GUARDIAN_GUARDIAN_ALLOWED_DRIFT", "1000")
System.put_env("GUARDIAN_GUARDIAN_VERIFY_ISSUER", "true")

The resulting updated config would be

config :guardian, Guardian,
  allowed_algos: ["RS256"],
  issuer: "issuer-prod.auth0.com",
  allowed_drift: 1000,
  verify_issuer: true