mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 02:26:26 +00:00
Chore: Moved universalAuthLogin function to utils
This commit is contained in:
@@ -509,7 +509,7 @@ func (tm *AgentManager) FetchNewAccessToken() error {
|
|||||||
// save as cache in memory
|
// save as cache in memory
|
||||||
tm.cachedClientSecret = clientSecret
|
tm.cachedClientSecret = clientSecret
|
||||||
|
|
||||||
err, loginResponse := universalAuthLogin(clientID, clientSecret)
|
loginResponse, err := util.UniversalAuthLogin(clientID, clientSecret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -725,20 +725,6 @@ func (tm *AgentManager) MonitorSecretChanges(secretTemplate Template, templateId
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func universalAuthLogin(clientId string, clientSecret string) (error, api.UniversalAuthLoginResponse) {
|
|
||||||
httpClient := resty.New()
|
|
||||||
httpClient.SetRetryCount(10000).
|
|
||||||
SetRetryMaxWaitTime(20 * time.Second).
|
|
||||||
SetRetryWaitTime(5 * time.Second)
|
|
||||||
|
|
||||||
tokenResponse, err := api.CallUniversalAuthLogin(httpClient, api.UniversalAuthLoginRequest{ClientId: clientId, ClientSecret: clientSecret})
|
|
||||||
if err != nil {
|
|
||||||
return err, api.UniversalAuthLoginResponse{}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, tokenResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
// runCmd represents the run command
|
// runCmd represents the run command
|
||||||
var agentCmd = &cobra.Command{
|
var agentCmd = &cobra.Command{
|
||||||
Example: `
|
Example: `
|
||||||
|
|||||||
Reference in New Issue
Block a user