select creds

This commit is contained in:
HiteshRepo 2024-02-05 20:50:35 +05:30
parent 79a0248049
commit 053323719e

View File

@ -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,