]> git.defcon.no Git - hermes/blobdiff - guc-clients/listsipusers
Added auto-location of config file to scripts tool-scripts
[hermes] / guc-clients / listsipusers
index 3648cd0fc6436319a8e2dcd79b4059c6d50d98c6..fccedb0e57a022170bed2d156a014f967f693073 100755 (executable)
@@ -13,14 +13,11 @@ use JSON;
 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);
@@ -30,8 +27,13 @@ my $config = AppConfig->new({ CREATE => 1 });
 $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,