Config-AWS
view release on metacpan or search on metacpan
use Test2::V0;
use Test2::Tools::Spec;
use Config::AWS;
use Path::Tiny qw( path tempdir );
use Ref::Util qw( is_globref );
my $DIR = tempdir 'ConfigAWS-XXXXXXXXX';
$DIR->child('config/.aws')->mkpath;
$DIR->child('credentials/.aws')->mkpath;
$DIR->child('config/.aws/config')->touch->spew(<<'CONFIG');
[alternate]
root_key = alternate root value
parent =
child = alternate value for child
another_root_key = alternate another root value
another_parent =
another_child = alternate value for another child
[default]
root_key = root value
another_root_key = another root value
parent =
child = value for child
[bad]
= ignored
empty_value =
parent =
child = bad child
false_parent = 0
child = ignored
trailing_empty =
CONFIG
$DIR->child('credentials/.aws/credentials')->touch->spew(<<'CREDENTIALS');
[profile default]
root_key = credentials root value
another_root_key = another credentials root value
parent =
child = value for credentials child
[profile with-hyphens]
key = key-with-hyphens
CREDENTIALS
my %PROFILES = (
default => {
root_key => 'root value',
another_root_key => 'another root value',
parent => {
child => 'value for child',
},
},
alternate => {
root_key => 'alternate root value',
another_root_key => 'alternate another root value',
parent => {
child => 'alternate value for child',
},
another_parent => {
another_child => 'alternate value for another child',
},
},
bad => {
empty_value => '',
parent => { child => 'bad child' },
( run in 2.046 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )