]> git.nbdom.net Git - nb.git/commitdiff
bin/ovh-api
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 4 Feb 2017 21:04:06 +0000 (21:04 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 4 Feb 2017 21:04:06 +0000 (21:04 +0000)
bin/ovh-api

index ad139ea3273d3353f3e7a2317bb4981d731b2b93..004cef2e6c8fd8832fa426a585edbb1327acf6fb 100755 (executable)
@@ -34,7 +34,8 @@ my %Opt = (
 get_options(\%Opt);
 # Auth
 if ($_ = $Opt{activate}) {
-  my $Api = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $_);
+  my @keys = /:/ ? split(':',$_) : ($_,'');
+  my $Api = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $keys[0], applicationSecret => $keys[1]);
   my $Answer = $Api->requestCredentials(accessRules => [ {
     method => 'ALL', path => '/*',
 # NB 04.02.17     method => 'GET', path => '/*',
@@ -71,6 +72,7 @@ if (@ARGV and $ARGV[0] =~ /^(\w+):(\w+):(\w+)$/) {
 
 } elsif ($ENV{$NAME.'_KEY'}) {
   @KEY = split(':',$ENV{$NAME.'_KEY'});
+
 } elsif (-e $config) {
   open(CONFIG,"$config") or die "$NAME: can't read $config";
   @KEY = split(":",chomp($_=<CONFIG>) && $_);