Skip to content

Commit 72511ed

Browse files
Return error if both Connect and Service Account credentials are provided
1 parent 4757263 commit 72511ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/onepassword/client/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@ func NewClient(integrationVersion string) (Client, error) {
2323
connectToken, _ := os.LookupEnv("OP_CONNECT_TOKEN")
2424
serviceAccountToken, _ := os.LookupEnv("OP_SERVICE_ACCOUNT_TOKEN")
2525

26+
if connectHost != "" && connectToken != "" && serviceAccountToken != "" {
27+
return nil, errors.New("invalid configuration. Either Connect or Service Account credentials should be set, not both")
28+
}
29+
2630
if serviceAccountToken != "" {
2731
return sdk.NewClient(sdk.Config{
2832
ServiceAccountToken: serviceAccountToken,
2933
IntegrationName: "1password-operator",
3034
IntegrationVersion: integrationVersion,
3135
})
32-
} else if connectHost != "" && connectToken != "" {
36+
}
37+
38+
if connectHost != "" && connectToken != "" {
3339
return connect.NewClient(connect.Config{
3440
ConnectHost: connectHost,
3541
ConnectToken: connectToken,

0 commit comments

Comments
 (0)