Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 4 new predicates #2

Merged
merged 4 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updated docs from list -> enumerable
  • Loading branch information
akoutmos committed Apr 21, 2020
commit 40c4fa46696f58963644a522ba3af12f6ec4f44d
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@ If the above example, we only want to expose our Prometheus metrics if the reque

Unplug provides the following predicates out of the box:

| Predicate | Description |
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `Unplug.Predicates.AppConfigEquals` | Given an application and a key, execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.AppConfigNotEquals` | Given an application and a key, do not execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.AppConfigIn` | Given an application and a key, execute the plug if the configured value is in the provided list of values |
| `Unplug.Predicates.AppConfigNotIn` | Given an application and a key, execute the plug if the configured value is not in the provided list of values |
| `Unplug.Predicates.EnvVarEquals` | Given an environment variable, execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.EnvVarNotEquals` | Given an environment variable, do not execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.EnvVarIn` | Given an environment variable, execute the plug if the environment variable value is in the provided list of values |
| `Unplug.Predicates.EnvVarNotIn` | Given an environment variable, execute the plug if the environment variable value is not in the provided list of values |
| `Unplug.Predicates.RequestHeaderEquals` | Given a request header, execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestHeaderNotEquals` | Given a request header, do not execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathEquals` | Given a request path, execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathNotEquals` | Given a request path, do not execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathIn` | Given a request path, execute the plug if the request value is in the the provided list of values |
| `Unplug.Predicates.RequestPathNotIn` | Given a request path, do not execute the plug if the request value is in the the provided list of values |
| Predicate | Description |
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `Unplug.Predicates.AppConfigEquals` | Given an application and a key, execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.AppConfigNotEquals` | Given an application and a key, do not execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.AppConfigIn` | Given an application and a key, execute the plug if the configured value is in the provided enumerable of values |
| `Unplug.Predicates.AppConfigNotIn` | Given an application and a key, execute the plug if the configured value is not in the provided enumerable of values |
| `Unplug.Predicates.EnvVarEquals` | Given an environment variable, execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.EnvVarNotEquals` | Given an environment variable, do not execute the plug if the configured value matches the expected value |
| `Unplug.Predicates.EnvVarIn` | Given an environment variable, execute the plug if the environment variable value is in the provided enumerable of values |
| `Unplug.Predicates.EnvVarNotIn` | Given an environment variable, execute the plug if the environment variable value is not in the provided enumerable of values |
| `Unplug.Predicates.RequestHeaderEquals` | Given a request header, execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestHeaderNotEquals` | Given a request header, do not execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathEquals` | Given a request path, execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathNotEquals` | Given a request path, do not execute the plug if the request value matches the expected value |
| `Unplug.Predicates.RequestPathIn` | Given a request path, execute the plug if the request value is in the the provided enumerable of values |
| `Unplug.Predicates.RequestPathNotIn` | Given a request path, do not execute the plug if the request value is in the the provided enumerable of values |

## Writing Your Own Predicates

Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/app_config_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.AppConfigIn do
@moduledoc """
Given an application and a key, execute the plug if the configured value
is in the provided list of values.
is in the provided enumerable of values.

Usage:
```elixir
Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/app_config_not_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.AppConfigNotIn do
@moduledoc """
Given an application and a key, execute the plug if the configured value
is not in the provided list of values.
is not in the provided enumerable of values.

Usage:
```elixir
Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/env_var_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.EnvVarIn do
@moduledoc """
Given an environment variable, execute the plug if the environment
variable value is in the provided list of values.
variable value is in the provided enumerable of values.

Usage:
```elixir
Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/env_var_not_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.EnvVarNotIn do
@moduledoc """
Given an environment variable, execute the plug if the environment
variable value is not in the provided list of values.
variable value is not in the provided enumerable of values.

Usage:
```elixir
Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/request_path_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.RequestPathIn do
@moduledoc """
Given a request path, execute the plug if the request value is in
the the provided list of values.
the the provided enumerable of values.

Usage:
```elixir
Expand Down
2 changes: 1 addition & 1 deletion lib/unplug/predicates/request_path_not_in.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Unplug.Predicates.RequestPathNotIn do
@moduledoc """
Given a request path, do not execute the plug if the request value is
in the the provided list of values.
in the the provided enumerable of values.

Usage:
```elixir
Expand Down