From 5e05fe8e7877ffd6bc473b77b8ca0a12ad26bd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 Mar 2024 16:23:56 +0100 Subject: Cowboy 2.12, Cowlib 2.13, Gun 2.1 --- .../cowboy/2.12/manual/cowboy.get_env/index.html | 209 +++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 docs/en/cowboy/2.12/manual/cowboy.get_env/index.html (limited to 'docs/en/cowboy/2.12/manual/cowboy.get_env/index.html') diff --git a/docs/en/cowboy/2.12/manual/cowboy.get_env/index.html b/docs/en/cowboy/2.12/manual/cowboy.get_env/index.html new file mode 100644 index 00000000..cb51a151 --- /dev/null +++ b/docs/en/cowboy/2.12/manual/cowboy.get_env/index.html @@ -0,0 +1,209 @@ + + + + + + + + + + Nine Nines: cowboy:get_env(3) + + + + + + + + + + + + + + + +
+
+
+
+ +

cowboy:get_env(3)

+ +

Name

+

cowboy:get_env - Retrieve a listener's environment value

+

Description

+
+
get_env(Name :: ranch:ref(),
+        Key  :: atom())
+    -> any()
+
+get_env(Name    :: ranch:ref(),
+        Key     :: atom(),
+        Default :: any())
+    -> any()
+
+

Retrieve an environment value for a previously started listener.

+

This function may crash when the key is missing from the environment and a default value is not provided.

+

Arguments

+
Name
+

The name of the listener to access.

+

The name of the listener is the first argument given to the cowboy:start_clear(3), cowboy:start_tls(3) or ranch:start_listener(3) function.

+
+
Key
+

The key in the environment map. Common keys include dispatch and middlewares.

+
+
Default
+

The default value if the key is missing.

+
+
+

Return value

+

The environment value is returned on success.

+

If a default was provided and the key is missing, then the default value is returned.

+

An exit:badarg exception is thrown when the listener does not exist.

+

An exit:{badkey, Key} exception is thrown when the key requested is missing and no default was provided.

+

Changelog

+
  • 2.11: Function introduced. +
  • +
+

Examples

+
Retrieve a listener's routes
+
+
Dispatch = cowboy:get_env(example, dispatch).
+
+

See also

+

cowboy(3), cowboy:start_clear(3), cowboy:start_tls(3), cowboy:set_env(3), ranch:get_protocol_options(3)

+ + + + + + +
+ +
+ + +

+ Cowboy + 2.12 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3