-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathforge.cgi
More file actions
executable file
·72 lines (56 loc) · 2.18 KB
/
Copy pathforge.cgi
File metadata and controls
executable file
·72 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl
#--------------------------------------------------------------------
#----- GRNOC TSDS Report GlobalNOC WebService Wrapper
#-----
#----- Copyright(C) 2012 The Trustees of Indiana University
#--------------------------------------------------------------------
#----- $LastChangedBy: $
#----- $LastChangedRevision: $
#----- $LastChangedDate: $
#----- $HeadURL: svn+ssh://svn.grnoc.iu.edu/grnoc/tsds/services/trunk/www/forge.cgi $
#----- $Id: forge.cgi 38789 2015-08-21 16:42:38Z prattadi $
#-----
#----- This script is designed to be loaded by Apache + mod_perl and
#----- is just a wrapper to the GRNOC::TSDS::GWS::Forge webservice
#----- library.
#--------------------------------------------------------------------
use strict;
use warnings;
use lib '../lib/';
use lib '/opt/grnoc/venv/grnoc-tsds-services/lib/perl5';
use GRNOC::TSDS::Config;
use GRNOC::TSDS::GWS::Forge;
use GRNOC::TSDS::Util::ConfigChooser;
use FindBin;
use Data::Dumper;
# needed for mod_perl
FindBin::again();
my $DEFAULT_CONFIG_FILE = '/etc/grnoc/tsds/services/config.xml';
my $DEFAULT_LOGGING_FILE = '/etc/grnoc/tsds/services/logging.conf';
my $TESTING_CONFIG_FILE = "$FindBin::Bin/../t/conf/tsds-services.xml";
our $websvc;
my $config_file;
my $logging_file;
my $location;
# we may have already created the websvc object earlier in mod_perl env
if ( !defined( $websvc ) ) {
if ( $ENV{'HTTP_HOST'} eq 'localhost:8529' ) {
$config_file = $TESTING_CONFIG_FILE;
$logging_file = $DEFAULT_LOGGING_FILE;
}
else {
$location = GRNOC::TSDS::Util::ConfigChooser->get_location($ENV{'REQUEST_URI'});
$config_file = $DEFAULT_CONFIG_FILE;
$logging_file = $location->{'logging_location'};
}
GRNOC::Log->new( config => $logging_file );
if (!-f $config_file) {
$config_file = '';
}
my $config = new GRNOC::TSDS::Config(config_file => $config_file);
$websvc = GRNOC::TSDS::GWS::Forge->new(config => $config);
$websvc->update_constraints_file($location->{'config_location'});
}
$location = GRNOC::TSDS::Util::ConfigChooser->get_location($ENV{'REQUEST_URI'});
$websvc->update_constraints_file($location->{'config_location'});
$websvc->handle_request();