View Source InfisicalEx (InfisicalEx v0.1.0)
InfisicalEx is a plugin for securely connecting and retrieving secrets from Infisical.
This module provides functionality to interact with the Infisical API, allowing Elixir applications to fetch and manage secrets seamlessly.
Summary
Functions
Retrieves all secrets available for the project. Use the environment from the given param.
Retrieves all secrets available for the project.
Retrieves a secret by its name from Infisical. Takes the environment from the config.
Retrieves a secret by its name from Infisical. Takes the environment from params.
Functions
Retrieves all secrets available for the project. Use the environment from the given param.
Example
iex> InfisicalEx.get_all_secrets("dev")
{:ok, %{
"DATABASE_URL" => "ecto://postgres:xxxx@localhost:5432/postgres",
"GUARDIAN_SECRET_KEY" => "xxxxx",
"POSTGRES_PASSWORD" => "xxxx!",
"RELEASE_COOKIE" => "xxxxx",
"S3_ACCESS_KEY" => "xxxxx",
"S3_SECRET_KEY" => "xxxx",
"SECRET_KEY_BASE" => "xxxxx",
"TURNSTILE_SECRET_KEY" => "xxx",
"TURNSTILE_SITE_KEY" => "xxxx"
}}
Retrieves all secrets available for the project.
Example
iex> InfisicalEx.get_all_secrets()
{:ok, %{
"DATABASE_URL" => "ecto://postgres:xxxx@localhost:5432/postgres",
"GUARDIAN_SECRET_KEY" => "xxxxx",
"POSTGRES_PASSWORD" => "xxxx!",
"RELEASE_COOKIE" => "xxxxx",
"S3_ACCESS_KEY" => "xxxxx",
"S3_SECRET_KEY" => "xxxx",
"SECRET_KEY_BASE" => "xxxxx",
"TURNSTILE_SECRET_KEY" => "xxx",
"TURNSTILE_SITE_KEY" => "xxxx"
}}
Retrieves a secret by its name from Infisical. Takes the environment from the config.
Example
iex> InfisicalEx.get_secret("DATABASE_PASSWORD")
{:ok, "secret"}
iex> InfisicalEx.get_secret("BAD_KEY")
{:error,
%{
"error" => "NotFound",
"message" => "Secret with name 'DATABASE_URL2' not found",
"reqId" => "req-90znAsRyfXUcUG",
"statusCode" => 404
}}
Retrieves a secret by its name from Infisical. Takes the environment from params.
Example
iex> InfisicalEx.get_secret("DATABASE_PASSWORD", "prod")
{:ok, "secret"}
iex> InfisicalEx.get_secret("DATABASE_PASSWORD", "bad_env")
{:error,
%{
"error" => "GetSecretByName",
"message" => "Folder with path '/' in environment with slug 'bad_env' not found",
"reqId" => "req-nzxiNt3LAAn0q4",
"statusCode" => 404
}}