]> git.defcon.no Git - hermes/blobdiff - guc-clients/add_apikey.pl
Added auto-location of config file to scripts tool-scripts
[hermes] / guc-clients / add_apikey.pl
index a543c23023414ed0c6be6c081db88481e4c7ac15..ce303bdadb9c54d0af080302667552d4c5eb3a30 100755 (executable)
@@ -13,13 +13,21 @@ my $level = "";
 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,