]> git.defcon.no Git - hermes/blobdiff - guc-clients/addsipuser
Added auto-location of config file to scripts tool-scripts
[hermes] / guc-clients / addsipuser
index cacbad2fd8df8339b2a03ad60fb91a0f80751e32..00eae4bdbef969f1523659e74129ea8e4cd77e30 100755 (executable)
@@ -18,7 +18,7 @@ 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);
@@ -37,6 +37,14 @@ $config->define("default_domain=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,
        "username=s"    => \$username,