Skip to content

Commit

Permalink
add patch
Browse files Browse the repository at this point in the history
Signed-off-by: outscale_hmi <[email protected]>
  • Loading branch information
outscale-hmi authored and jerome-jutteau committed Sep 27, 2022
1 parent 742caab commit 93ed198
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .osc-patches/2022-09-22-add-missing-parameters.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
From ab07cc51fc1e484d834cdba432c363ffd0586742 Mon Sep 17 00:00:00 2001
From: outscale_hmi <[email protected]>
Date: Thu, 22 Sep 2022 11:11:01 +0000
Subject: [PATCH] add parameters to configEnv

Signed-off-by: outscale_hmi <[email protected]>
---
v2/config_env.go | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/v2/config_env.go b/v2/config_env.go
index f41fe3ff..773a9720 100644
--- a/v2/config_env.go
+++ b/v2/config_env.go
@@ -12,6 +12,8 @@ type ConfigEnv struct {
OutscaleApiEndpoint *string
ProfileName *string
Region *string
+ X509ClientCert *string
+ X509ClientKey *string
}

func NewConfigEnv() *ConfigEnv {
@@ -31,13 +33,22 @@ func NewConfigEnv() *ConfigEnv {
if value, present := os.LookupEnv("OSC_REGION"); present {
configEnv.Region = &value
}
+ if value, present := os.LookupEnv("OSC_X509_CLIENT_CERT"); present {
+ configEnv.X509ClientCert = &value
+ }
+ if value, present := os.LookupEnv("OSC_X509_CLIENT_KEY"); present {
+ configEnv.X509ClientKey = &value
+ }
return &configEnv
}

func (configEnv *ConfigEnv) Configuration() (*Configuration, error) {
var config *Configuration

- if configEnv.ProfileName != nil {
+ if configEnv.AccessKey == nil && configEnv.SecretKey == nil {
+ if configEnv.ProfileName == nil {
+ *configEnv.ProfileName = "Default"
+ }
configFile, err := LoadDefaultConfigFile()
if err != nil {
return nil, err
@@ -83,7 +94,10 @@ func (configEnv *ConfigEnv) Context(ctx context.Context) (context.Context, error
var accessKey *string
var secretKey *string

- if configEnv.ProfileName != nil {
+ if configEnv.AccessKey == nil && configEnv.SecretKey == nil {
+ if configEnv.ProfileName == nil {
+ *configEnv.ProfileName = "Default"
+ }
configFile, err := LoadDefaultConfigFile()
if err != nil {
return nil, err
--
2.25.1

0 comments on commit 93ed198

Please sign in to comment.