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

Functions for dealing with configuration secrets.

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.

Types

@type 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"]}
@type secret() :: mfa_secret() | function() | String.t()

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

Functions

@spec 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}