ConfigurationResolver
in package
Resolves configuration values from, in order of precedence: 1. An AWS_-prefixed environment variable.
- The shared config file (AWS_CONFIG_FILE, defaulting to ~/.aws/config).
- A caller-supplied default.
Table of Contents
Constants
- DEFAULT_PROFILE = 'default'
- ENV_CONFIG_FILE = 'AWS_CONFIG_FILE'
- ENV_PROFILE = 'AWS_PROFILE'
- PROFILE_PREFIX = 'profile '
- Prefix AWS applies to every non-default profile section in the config file.
Properties
- $envPrefix : mixed
Methods
- env() : mixed|null
- Resolves a value from an AWS_-prefixed environment variable.
- ini() : mixed|null
- Resolves a value from the shared config file.
- resolve() : mixed
Constants
DEFAULT_PROFILE
public
mixed
DEFAULT_PROFILE
= 'default'
ENV_CONFIG_FILE
public
mixed
ENV_CONFIG_FILE
= 'AWS_CONFIG_FILE'
ENV_PROFILE
public
mixed
ENV_PROFILE
= 'AWS_PROFILE'
PROFILE_PREFIX
Prefix AWS applies to every non-default profile section in the config file.
public
mixed
PROFILE_PREFIX
= 'profile '
Properties
$envPrefix
public
static mixed
$envPrefix
= 'AWS_'
Methods
env()
Resolves a value from an AWS_-prefixed environment variable.
public
static env(string $key[, string $expectedType = 'string' ]) : mixed|null
Parameters
- $key : string
- $expectedType : string = 'string'
Return values
mixed|nullini()
Resolves a value from the shared config file.
public
static ini(string $key, string $expectedType[, string|null $profile = null ][, string|null $filename = null ][, array<string|int, mixed> $options = [] ]) : mixed|null
Parameters
- $key : string
- $expectedType : string
- $profile : string|null = null
-
Profile to read. Defaults to AWS_PROFILE, then "default".
- $filename : string|null = null
-
Config file path. Defaults to AWS_CONFIG_FILE, then ~/.aws/config.
- $options : array<string|int, mixed> = []
-
Subsection lookup options ('section', 'subsection', 'key').
Return values
mixed|nullresolve()
public
static resolve(string $key, mixed $defaultValue, string $expectedType[, array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $key : string
-
Key to look up in the environment / config file.
- $defaultValue : mixed
-
Returned when nothing else resolves.
- $expectedType : string
-
Type to coerce the resolved value to.
- $config : array<string|int, mixed> = []
-
Options: 'ini_resolver_options', 'use_aws_shared_config_files'.