mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-21 23:18:06 +00:00
Return error if both Connect and Service Account credentials are provided
This commit is contained in:
@@ -23,13 +23,19 @@ func NewClient(integrationVersion string) (Client, error) {
|
||||
connectToken, _ := os.LookupEnv("OP_CONNECT_TOKEN")
|
||||
serviceAccountToken, _ := os.LookupEnv("OP_SERVICE_ACCOUNT_TOKEN")
|
||||
|
||||
if connectHost != "" && connectToken != "" && serviceAccountToken != "" {
|
||||
return nil, errors.New("invalid configuration. Either Connect or Service Account credentials should be set, not both")
|
||||
}
|
||||
|
||||
if serviceAccountToken != "" {
|
||||
return sdk.NewClient(sdk.Config{
|
||||
ServiceAccountToken: serviceAccountToken,
|
||||
IntegrationName: "1password-operator",
|
||||
IntegrationVersion: integrationVersion,
|
||||
})
|
||||
} else if connectHost != "" && connectToken != "" {
|
||||
}
|
||||
|
||||
if connectHost != "" && connectToken != "" {
|
||||
return connect.NewClient(connect.Config{
|
||||
ConnectHost: connectHost,
|
||||
ConnectToken: connectToken,
|
||||
|
Reference in New Issue
Block a user