mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 02:27:37 +00:00
Fix: Helper function for getting service token
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Infisical/infisical-merge/packages/models"
|
"github.com/Infisical/infisical-merge/packages/models"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DecodedSymmetricEncryptionDetails = struct {
|
type DecodedSymmetricEncryptionDetails = struct {
|
||||||
@@ -63,6 +64,20 @@ func IsSecretTypeValid(s string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetInfisicalServiceToken(cmd *cobra.Command) (serviceToken string, err error) {
|
||||||
|
infisicalToken, err := cmd.Flags().GetString("token")
|
||||||
|
|
||||||
|
if infisicalToken == "" {
|
||||||
|
infisicalToken = os.Getenv(INFISICAL_TOKEN_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return infisicalToken, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Checks if the passed in email already exists in the users slice
|
// Checks if the passed in email already exists in the users slice
|
||||||
func ConfigContainsEmail(users []models.LoggedInUser, email string) bool {
|
func ConfigContainsEmail(users []models.LoggedInUser, email string) bool {
|
||||||
for _, value := range users {
|
for _, value := range users {
|
||||||
|
|||||||
Reference in New Issue
Block a user