mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 01:12:59 +00:00
Requested changes
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Infisical/infisical-merge/packages/config"
|
||||
"github.com/Infisical/infisical-merge/packages/models"
|
||||
)
|
||||
|
||||
@@ -52,7 +49,6 @@ func IsAuthMethodValid(authMethod string, allowUserAuth bool) (isValid bool, str
|
||||
}
|
||||
|
||||
func ShouldUseInfisicalToken(token *models.TokenDetails, validTokenTypes []string) bool {
|
||||
|
||||
if token == nil {
|
||||
return false
|
||||
}
|
||||
@@ -63,24 +59,9 @@ func ShouldUseInfisicalToken(token *models.TokenDetails, validTokenTypes []strin
|
||||
}
|
||||
|
||||
for _, tokenType := range validTokenTypes {
|
||||
if token.Type != tokenType {
|
||||
continue
|
||||
if token.Type == tokenType {
|
||||
return true
|
||||
}
|
||||
|
||||
details, err := GetCurrentLoggedInUserDetails()
|
||||
if err == nil && details.IsUserLoggedIn && !details.LoginExpired && !config.INFISICAL_SILENT_MODE {
|
||||
|
||||
var usingFrom string
|
||||
if token.PassedAsFlag {
|
||||
usingFrom = "--token flag"
|
||||
} else {
|
||||
usingFrom = "INFISICAL_TOKEN environment variable"
|
||||
}
|
||||
PrintWarning(fmt.Sprintf("You are currently logged in, but the command will be using the token provided from the %s.", usingFrom))
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user