Skip to content
Snippets Groups Projects
WardenClientConf.pm 1 KiB
Newer Older
Tomáš Plesník's avatar
Tomáš Plesník committed
#!/usr/bin/perl -w
#
# WardenClientConf.pm
#
Tomáš Plesník's avatar
Tomáš Plesník committed
# Copyright (C) 2011-2012 Cesnet z.s.p.o
Tomáš Plesník's avatar
Tomáš Plesník committed
#
# Use of this source is governed by a BSD-style license, see LICENSE file.  
Tomáš Plesník's avatar
Tomáš Plesník committed

package WardenClientConf;

use strict;
require Exporter;

our @ISA = qw(Exporter);
our @EXPORT_OK = qw($URI $SSL_KEY_FILE $SSL_CERT_FILE $SSL_CA_FILE $MAX_RCV_EVENTS_LIMIT $LOG_STDERR $LOG_SYSLOG $LOG_SYSLOG_FACILITY $LOG_VERBOSE);

# preset of default variables
our $URI = undef;
our $SSL_KEY_FILE = undef;
our $SSL_CERT_FILE = undef;
our $SSL_CA_FILE = undef;
our $MAX_RCV_EVENTS_LIMIT = undef;
our $LOG_SYSLOG = 0;
our $LOG_SYSLOG_FACILITY = "local7";
our $LOG_VERBOSE = 0;

Tomáš Plesník's avatar
Tomáš Plesník committed

Tomáš Plesník's avatar
Tomáš Plesník committed

sub loadConf
Tomáš Plesník's avatar
Tomáš Plesník committed
  my $conf_file = shift;

  # load configuration variables set by user
  unless (do $conf_file) {
    die("Errors in config file '$conf_file': $@") if $@;
    die("Can't read config file '$conf_file': $!") unless defined $_;
    # if $_ defined, it's retvalue of last statement of conf, for which we don't care
Tomáš Plesník's avatar
Tomáš Plesník committed
  }
Tomáš Plesník's avatar
Tomáš Plesník committed
1;