Small Elixir cowboy plug to toggle routes based on their path by a environment variable or app config
The package can be installed by adding route_toggle_plug
to your list of dependencies in mix.exs
:
def deps do
[
{:route_toggle_plug, git: "https://github.com/stanansems/RouteTogglePlug.git", tag: "0.1.2"}
]
end
Add plug
plug RouteTogglePlug, paths: ["/docs", "/docs-json"], key: :docs_enabled
Configuration to add to config.exs
config :route_toggle_plug,
docs_enabled: true
Configure in release.exs to use an ENV variable on runtime
config :route_toggle_plug,
docs_enabled: System.get_env("DOCS_ENABLED")