-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config update #668
Merged
Merged
Config update #668
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice to support (and needed in outscale/osc-bsu-csi-driver#355) but those options need to be passed to client configuration to really use client certificates.