]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/opensrf_settings_puller.pl
LP1615805 No inputs after submit in patron search (AngularJS)
[Evergreen.git] / Open-ILS / src / extras / opensrf_settings_puller.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Data::Dumper;
7
8 use OpenSRF::Utils::SettingsClient;
9 use OpenSRF::Utils::Config;
10 use OpenSRF::Utils::SettingsParser;
11
12 # TODO: GetOpts to set these
13 my $config_file = '/openils/conf/opensrf_core.xml';
14 my $verbose = 0;
15
16 sub usage {
17     return <<USAGE
18
19     usage: $0 xpath/traversing/string
20
21 Reads $config_file and dumps the structure found at the element
22 located by the xpath argument.  Without argument, dumps whole <config>.
23
24     example: $0 apps/open-ils.search/app_settings
25 USAGE
26 }
27
28 sub die_usage {
29     @_ and print "ERROR: @_\n";
30     print usage();
31     exit 1;
32 }
33
34 my $load = OpenSRF::Utils::Config->load(
35     config_file => $config_file
36 );
37 my $booty = $load->bootstrap();
38
39 my $conf   = OpenSRF::Utils::Config->current;
40 my $cfile  = $conf->bootstrap->settings_config;
41 my $parser = OpenSRF::Utils::SettingsParser->new();
42 $parser->initialize( $cfile );
43 $OpenSRF::Utils::SettingsClient::host_config = $parser->get_server_config($conf->env->hostname);
44
45 my $settings = OpenSRF::Utils::SettingsClient->new();
46 # scalar(@ARGV) or die_usage("Argument is required");
47 my @terms = scalar(@ARGV) ? split('/', shift) : ();
48 $verbose and print "Looking under: ", join(', ', map {"<$_>"} @terms), "\n";
49
50 my $target = $settings->config_value(@terms);
51 print Dumper($target);
52
53 # my $lines = $target->{callfile_lines};
54