From 8f6e0e85b97f32f8fb8f9db9ef159b23277500fe Mon Sep 17 00:00:00 2001 From: outscale_hmi Date: Fri, 23 Sep 2022 08:00:53 +0000 Subject: [PATCH] add patch Signed-off-by: outscale_hmi --- .../2022-09-22-add-missing-parameters.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .osc-patches/2022-09-22-add-missing-parameters.patch diff --git a/.osc-patches/2022-09-22-add-missing-parameters.patch b/.osc-patches/2022-09-22-add-missing-parameters.patch new file mode 100644 index 000000000..af92e15dc --- /dev/null +++ b/.osc-patches/2022-09-22-add-missing-parameters.patch @@ -0,0 +1,62 @@ +From ab07cc51fc1e484d834cdba432c363ffd0586742 Mon Sep 17 00:00:00 2001 +From: outscale_hmi +Date: Thu, 22 Sep 2022 11:11:01 +0000 +Subject: [PATCH] add parameters to configEnv + +Signed-off-by: outscale_hmi +--- + 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 +