StanAnsems / RouteTogglePlug

Small Elixir plug to toggle routes based on their path by a environment variable or app config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RouteTogglePlug

Small Elixir cowboy plug to toggle routes based on their path by a environment variable or app config

Installation

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

Configuration

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")

About

Small Elixir plug to toggle routes based on their path by a environment variable or app config


Languages

Language:Elixir 100.0%