# Copyright 1999-2012. Parallels IP Holdings GmbH. All Rights Reserved.
package DumpAgentConfig;

# Module to read dump agent's configuration file - "config.json".

use strict;

use JSON;
use DumperUtils;

my $configLoaded = 0;
my $configData;

sub getValue {
  my ($varName) = @_;

  _loadDumpAgentConfig();

  return $configData->{$varName};
}

sub _loadDumpAgentConfig {
  if (!$configLoaded) {
    my $json = JSON->new;
    my $configFileContents = DumperUtils::readFile('config.json');
    if ($configFileContents) {
      $configData = $json->decode($configFileContents);
    }
    $configLoaded = 1;
  }
}

1;
