Ueberauth.Strategy.Mastodon.Secret (ueberauth_mastodon v0.2.0) View Source

Functions for dealing with configuration secrets.

Link to this section Summary

Types

Tuple in the form {module, function_name, args}. Parsed into a string at runtime.

A configuration secret. Either a mfa_secret/0, a function, or a string.

Functions

Accepts a secret/0 and returns a tuple with the parsed string. Useful for runtime configuration.

Link to this section Types

Specs

mfa_secret() :: {module(), function_name :: atom(), args :: [any()]}

Tuple in the form {module, function_name, args}. Parsed into a string at runtime.

Example:

{System, :get_env, ["SECRET_KEY"]}

Specs

secret() :: mfa_secret() | function() | String.t()

A configuration secret. Either a mfa_secret/0, a function, or a string.

Link to this section Functions

Specs

parse_secret(secret()) :: {:ok, String.t()} | {:error, any()}

Accepts a secret/0 and returns a tuple with the parsed string. Useful for runtime configuration.

Example:

iex(1)> parse_secret({System, :get_env, ["SECRET_KEY"]})
{:ok, "12345678"}
iex(2)> parse_secret(nil)
{:error, nil}