PhoenixKit.Config.AWS (phoenix_kit v1.7.71)

Copy Markdown View Source

AWS configuration management for PhoenixKit.

This module provides a centralized way to manage AWS configuration.

Usage

# Get AWS region
region = PhoenixKit.Config.AWS.region()

# Get AWS access key ID
access_key_id = PhoenixKit.Config.AWS.access_key_id()

# Get AWS secret access key
secret_access_key = PhoenixKit.Config.AWS.secret_access_key()

Configuration

AWS configuration is grouped under the :aws key in PhoenixKit config:

config :phoenix_kit,
  aws: [
    region: "eu-north-1",
    access_key_id: "AKIAIOSFODNN7EXAMPLE",
    secret_access_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  ]

Configuration Keys

  • :region - AWS region (default: "eu-north-1")
  • :access_key_id - AWS access key ID
  • :secret_access_key - AWS secret access key

Examples

# Get AWS region
region = PhoenixKit.Config.AWS.region()
#=> "eu-north-1"

# Get AWS access key ID
access_key_id = PhoenixKit.Config.AWS.access_key_id()
#=> "AKIAIOSFODNN7EXAMPLE"

Summary

Functions

Gets the AWS access key ID.

Gets a specific AWS configuration value.

Gets a specific AWS configuration value with a default.

Gets the AWS configuration keyword list.

Gets the AWS region.

Gets the AWS secret access key.

Functions

access_key_id()

@spec access_key_id() :: String.t() | nil

Gets the AWS access key ID.

Returns the configured access key ID from application config.

Examples

iex> PhoenixKit.Config.AWS.access_key_id()
"AKIAIOSFODNN7EXAMPLE"

iex> PhoenixKit.Config.AWS.access_key_id()
nil

get(key)

@spec get(atom()) :: {:ok, any()} | :not_found

Gets a specific AWS configuration value.

Examples

iex> PhoenixKit.Config.AWS.get(:region)
{:ok, "eu-north-1"}

iex> PhoenixKit.Config.AWS.get(:nonexistent)
:not_found

get(key, default)

@spec get(atom(), any()) :: any()

Gets a specific AWS configuration value with a default.

Examples

iex> PhoenixKit.Config.AWS.get(:region, "us-east-1")
"eu-north-1"

get_all()

@spec get_all() :: Keyword.t()

Gets the AWS configuration keyword list.

Examples

iex> PhoenixKit.Config.AWS.get_all()
[region: "eu-north-1", access_key_id: "AKIA...", secret_access_key: "..."]

region()

@spec region() :: String.t()

Gets the AWS region.

Returns the configured region from application config with a fallback to "eu-north-1".

Examples

iex> PhoenixKit.Config.AWS.region()
"us-east-1"

iex> PhoenixKit.Config.AWS.region()
"eu-north-1"

secret_access_key()

@spec secret_access_key() :: String.t() | nil

Gets the AWS secret access key.

Returns the configured secret access key from application config.

Examples

iex> PhoenixKit.Config.AWS.secret_access_key()
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

iex> PhoenixKit.Config.AWS.secret_access_key()
nil