Class ConfigurationResolver
Methods Summary
-
static
resolve ( string $key, mixed $defaultValue, string $expectedType, array $config = [] )
Generic configuration resolver that first checks for environment variables, then checks for a specified profile in the environment-defined config file location (env variable is 'AWS_CONFIG_FILE', file location defaults to ~/.aws/config), then checks for the "default" profile in the environment-defined config file location, and failing those uses a default fallback value.
-
static
env ( string $key, string $expectedType )
Resolves config values from environment variables.
-
static
ini ( string $key, string $expectedType, string|null $profile = null, string|null $filename = null, $options = [] )
Gets config values from a config file whose location is specified by an environment variable 'AWS_CONFIG_FILE', defaulting to ~/.aws/config if not specified
Methods Details
static mixed resolve ( string $key, mixed $defaultValue, string $expectedType, array $config = [] )
Generic configuration resolver that first checks for environment variables, then checks for a specified profile in the environment-defined config file location (env variable is 'AWS_CONFIG_FILE', file location defaults to ~/.aws/config), then checks for the "default" profile in the environment-defined config file location, and failing those uses a default fallback value.
Parameters
string | $key | Configuration key to be used when attempting to retrieve value from the environment or ini file. |
mixed | $defaultValue | |
string | $expectedType | The expected type of the retrieved value. |
array | $config = [] | additional configuration options. |
Returns
mixed |
static null env ( string $key, string $expectedType )
Resolves config values from environment variables.
Parameters
string | $key | Configuration key to be used when attempting to retrieve value from the environment. |
string | $expectedType | The expected type of the retrieved value. |
Returns
null | mixed |
static null ini ( string $key, string $expectedType, string|null $profile = null, string|null $filename = null, $options = [] )
Gets config values from a config file whose location is specified by an environment variable 'AWS_CONFIG_FILE', defaulting to ~/.aws/config if not specified
Parameters
string | $key | Configuration key to be used when attempting to retrieve value from ini file. |
string | $expectedType | The expected type of the retrieved value. |
string|null | $profile = null | Profile to use. If not specified will use the "default" profile. |
string|null | $filename = null | If provided, uses a custom filename rather than looking in the default directory. |
$options = [] |
Returns
null | mixed |
Constants summary
string |
ENV_PROFILE
|
#
'AWS_PROFILE'
|
string |
ENV_CONFIG_FILE
|
#
'AWS_CONFIG_FILE'
|