Skip to content

Commit

Permalink
Set json_typed via config file
Browse files Browse the repository at this point in the history
  • Loading branch information
stdweird committed Mar 22, 2015
1 parent 481905d commit 2814f8c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/perl/CCfg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Readonly::Hash my %DEFAULT_CFG => {
"debug" => undef,
"force" => undef,
"get_timeout" => 30,
"json_typed" => 0,
"keep_old" => 2,
"key_file" => undef,
"lock_retries" => 3,
Expand Down
8 changes: 7 additions & 1 deletion src/main/perl/Fetch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,13 @@ sub choose_interpreter
my $tree;
if ($self->{PROFILE_URL} =~ m{json(?:\.gz)?$}) {
$tree = decode_json($profile);
return ('EDG::WP4::CCM::JSONProfileSimple', ['profile', $tree]);
my $module;
if ($self->{JSON_TYPED}) {
$module = 'EDG::WP4::CCM::JSONProfileTyped';
} else {
$module = 'EDG::WP4::CCM::JSONProfileSimple';
}
return ($module, ['profile', $tree]);
}

my $xmlParser = new XML::Parser(Style => 'Tree');
Expand Down
2 changes: 1 addition & 1 deletion src/test/perl/test-ccfg.t
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ while (my ($k, $v) = each %expected) {

# Hard test for possible values (sorted)
is_deeply(\@CFG_KEYS, [qw(base_url ca_dir ca_file cache_root cert_file
context dbformat debug force get_timeout keep_old
context dbformat debug force get_timeout json_typed keep_old
key_file lock_retries lock_wait preprocessor profile profile_failover
purge_time retrieve_retries retrieve_wait trust world_readable
)], "CFG_KEYS exports all possible configuration keys");
Expand Down

0 comments on commit 2814f8c

Please sign in to comment.