my $keyfile ="";
my $api_base = "";
my $api_key = "";
-my $configfile;
+my $configfile = undef;
my $config = AppConfig->new( { CREATE => 1 } );
$config->define("api_url=s");
$config->define("api_keyfile=s");
+foreach (
+ "/usr/local/etc/hermes/hermes_config",
+ "/usr/local/etc/hermes/config",
+ "/etc/hermes/config",
+ $ENV{"HOME"} . "/.hermes/config",
+ $ENV{"HOME"} . "/.hermes_config",
+) { $configfile = $_ if ( -f $_ ); }
+
GetOptions(
"help" => \$help,
"host=s" => \$host_ip,
my $help;
my $username;
-my $configfile;
+my $configfile = undef;
my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $displayname, $phone, $mail, $sipuser, $linetext);
#TODO: Move this to config file.
$config->default_domain("hig.no");
+foreach (
+ "/usr/local/etc/hermes/hermes_config",
+ "/usr/local/etc/hermes/config",
+ "/etc/hermes/config",
+ $ENV{"HOME"} . "/.hermes/config",
+ $ENV{"HOME"} . "/.hermes_config",
+) { $configfile = $_ if ( -f $_ ); }
+
GetOptions(
"help" => \$help,
"username=s" => \$username,
my $help;
my $username;
-my $configfile;
+my $configfile = undef;
my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $sipuser, $mac);
$config->define("api_url=s");
$config->define("api_keyfile=s");
+foreach (
+ "/usr/local/etc/hermes/hermes_config",
+ "/usr/local/etc/hermes/config",
+ "/etc/hermes/config",
+ $ENV{"HOME"} . "/.hermes/config",
+ $ENV{"HOME"} . "/.hermes_config",
+) { $configfile = $_ if ( -f $_ ); }
+
GetOptions(
"help" => \$help,
"macaddress=s" => \$mac,
my $help;
my $username;
-my $configfile;
+my $configfile = undef;
my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $displayname, $phone, $mail, $sipuser, $linetext);
$config->define("numbers_local_series=s");
$config->define("numbers_countrycode=s");
+foreach (
+ "/usr/local/etc/hermes/hermes_config",
+ "/usr/local/etc/hermes/config",
+ "/etc/hermes/config",
+ $ENV{"HOME"} . "/.hermes/config",
+ $ENV{"HOME"} . "/.hermes_config",
+) { $configfile = $_ if ( -f $_ ); }
+
GetOptions(
"help" => \$help,
"username=s" => \$username,
use AppConfig;
use Text::Iconv;
-use Data::Dumper;
-
-my $utf2iso = Text::Iconv->new("utf-8","latin1");
my $api_key;
my $help;
my $username;
-my $configfile;
+my $configfile = undef;
my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $displayname, $phone, $mail, $sipuser, $linetext);
$config->define("api_url=s");
$config->define("api_keyfile=s");
-#TODO: Move this to config file.
-$config->default_domain("hig.no");
+foreach (
+ "/usr/local/etc/hermes/hermes_config",
+ "/usr/local/etc/hermes/config",
+ "/etc/hermes/config",
+ $ENV{"HOME"} . "/.hermes/config",
+ $ENV{"HOME"} . "/.hermes_config",
+) { $configfile = $_ if ( -f $_ ); }
GetOptions(
"help" => \$help,