-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: bug which required optional hmac type #275
Conversation
Did you already implemented a validation of |
if hmacAuthType != "" { | ||
client, err = metalgo.NewDriver(driverURL, apiToken, hmacKey, metalgo.AuthType(hmacAuthType)) | ||
} else { | ||
client, err = metalgo.NewDriver(driverURL, apiToken, hmacKey) | ||
} |
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.
You can set default values in viper!
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.
You mean like this? Unsure if its better than the if statement, but I can change it, if you like.
viper.SetDefault("hmac-auth-type", ctx.HMACAuthType)
hmacAuthType := viper.GetString("hmac-auth-type")
No, currently there is no validation of the hmac type. Neither on the client side, nor on the server side. Technically it could be any string. Currently there aren't even constants |
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.
To me it looks okay.
Description
If not given, this will rely on the default server behavior.
Alternatively: make this hmac type mandatory in the config and make this a breaking change.