Replug v0.1.0 API Reference

Modules

# ---- router.ex ----
plug Replug,
  plug: Corsica,
  opts: {MyAppWeb.PlugConfigs, :corsica}

# ---- plug_configs.ex ----
defmodule MyAppWeb.PlugConfigs do
  def corsica do
    [
      max_age: System.get_env("CORSICA_MAX_AGE"),
      expose_headers: ~w(X-Foo),
      origins: System.get_env("VALID_ORIGINS")
    ]
  end
end

This config module takes either a keyword list or a map where the keys are the option fields and the values are environment variable keys. The environment variable keys are then extrapolated out to their configured values. For example, if provided with a keyword list of

This config module takes either a keyword list or a map where the keys are the option fields and the values are environment variable keys. The environment variable keys are then extrapolated out to their configured values. For example, if provided with a keyword list of