ExRunTime v0.2.2 ExRunTime View Source

Tiny elixir library useful for examining the runtime environment.

Link to this section Summary

Functions

Examines the system environment variables to determine whether or not the application is running in Kubernetes.

Examines the system environment variables to determine whether or not the application is running in the production environment.

Examines the system environment variables to determine whether or not the application is running in test.

Link to this section Functions

Link to this function

is_kubernetes?(env \\ System.get_env()) View Source
is_kubernetes?(%{optional(String.t()) => String.t()}) :: boolean()

Examines the system environment variables to determine whether or not the application is running in Kubernetes.

Returns true or false.

Uses System.get_env() by default but you can pass in your own map.

Examples

iex> ExRunTime.is_kubernetes?(%{"KUBERNETES_POD" => "some-pod"})
true
iex> ExRunTime.is_kubernetes?(%{})
false
Link to this function

is_production_deploy?(env \\ System.get_env()) View Source
is_production_deploy?(%{optional(String.t()) => String.t()}) :: boolean()

Examines the system environment variables to determine whether or not the application is running in the production environment.

Returns true or false.

Uses System.get_env() by default but you can pass in your own map.

Examples

iex> ExRunTime.is_production_deploy?()
false
iex> ExRunTime.is_production_deploy?(%{})
false
iex> ExRunTime.is_production_deploy?(%{"DEPLOYED_ENV" => "test"})
false
iex> ExRunTime.is_production_deploy?(%{"DEPLOYED_ENV" => "prod"})
true
Link to this function

is_test?(env \\ System.get_env()) View Source
is_test?(%{optional(String.t()) => String.t()}) :: boolean()

Examines the system environment variables to determine whether or not the application is running in test.

Returns true or false.

Uses System.get_env() by default but you can pass in your own map.

Examples

iex> ExRunTime.is_test?()
false
iex> ExRunTime.is_test?(%{})
false
iex> ExRunTime.is_test?(%{"MIX_ENV" => "test"})
true
iex> ExRunTime.is_test?(%{"MIX_ENV" => "prod"})
false