Skip to content
Snippets Groups Projects
WardenClientConf.pm 1012 B
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;

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

#-------------------------------------------------------------------------------
# loadConf - load variables from configuration file
#-------------------------------------------------------------------------------
sub loadConf
{
  my $conf_file = shift;

  # preset of default variables
  our $URI = undef;
  our $SSL_KEY_FILE = undef;
  our $SSL_CERT_FILE = undef;
  our $SSL_CA_FILE = undef;
Tomáš Plesník's avatar
Tomáš Plesník committed

  # read config file
  if ( ! open( TMP, $conf_file) ) {
    die("Can't read config file '$conf_file': $!\n");
  }
  close TMP;

  # load set variables by user
  if ( !do $conf_file ) {
    die("Errors in config file '$conf_file': $@");
  }

  return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE, $MAX_RCV_EVENTS_LIMIT);
Tomáš Plesník's avatar
Tomáš Plesník committed

} # End of loadConf
1;