ExStorageServiceCli.Config (ex_storage_service_cli v0.1.0)

Copy Markdown View Source

Manages CLI configuration profiles stored in ~/.config/ess/config.toml.

Supports multiple named profiles with credentials and endpoint settings.

Config File Format

[default]
endpoint = "http://localhost:9000"
access_key_id = "AKIA..."
secret_access_key = "..."
region = "us-east-1"

[profiles.production]
endpoint = "https://s3.example.com"
access_key_id = "AKIA..."
secret_access_key = "..."
region = "us-east-1"

Summary

Functions

Returns the path to the config directory.

Returns the path to the config file.

Lists all available profile names.

Loads a named profile from the config file.

Saves a profile to the config file.

Functions

config_dir()

Returns the path to the config directory.

config_path()

Returns the path to the config file.

list_profiles()

@spec list_profiles() :: [String.t()]

Lists all available profile names.

load_profile(profile_name)

@spec load_profile(String.t()) :: map()

Loads a named profile from the config file.

Returns a map with :endpoint, :access_key_id, :secret_access_key, :region. Returns an empty map if the profile or config file doesn't exist.

save_profile(profile_name, profile_data)

@spec save_profile(String.t(), map()) :: :ok | {:error, term()}

Saves a profile to the config file.

Creates the config directory and file if they don't exist. Merges with existing config if the file already exists.