From 053323719e5a8af92a2bbc7a2d5db62a2177767b Mon Sep 17 00:00:00 2001 From: HiteshRepo Date: Mon, 5 Feb 2024 20:50:35 +0530 Subject: [PATCH] select creds --- src/pkg/credentials/m365.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pkg/credentials/m365.go b/src/pkg/credentials/m365.go index 187f220b3..5955c2cc1 100644 --- a/src/pkg/credentials/m365.go +++ b/src/pkg/credentials/m365.go @@ -2,6 +2,7 @@ package credentials import ( "fmt" + "math/rand" "os" "strings" @@ -32,6 +33,19 @@ func GetM365() M365 { fmt.Println("---------------> check", strings.Contains(AzureClientID, ",")) fmt.Println("---------------> check", strings.Contains(AzureClientSecret, ",")) + randomNumber := rand.Intn(4) + 1 + fmt.Println("---------> random", randomNumber) + + if strings.Contains(AzureClientID, ",") { + AzureClientIDs := strings.Split(AzureClientID, ",") + AzureClientID = AzureClientIDs[randomNumber] + } + + if strings.Contains(AzureClientID, ",") { + AzureClientSecrets := strings.Split(AzureClientSecret, ",") + AzureClientSecret = AzureClientSecrets[randomNumber] + } + return M365{ AzureClientID: AzureClientID, AzureClientSecret: AzureClientSecret,