mirror of
https://github.com/Infisical/infisical.git
synced 2026-05-02 03:02:03 -04:00
Fix: Secret interpolation not working as intended for fetching secrets by name
This commit is contained in:
@@ -478,6 +478,17 @@ func getSecretsByNames(cmd *cobra.Command, args []string) {
|
||||
util.HandleError(err, "To fetch all secrets")
|
||||
}
|
||||
|
||||
if shouldExpand {
|
||||
authParams := models.ExpandSecretsAuthentication{}
|
||||
if token != nil && token.Type == "service-token" {
|
||||
authParams.InfisicalToken = token.Token
|
||||
} else if token != nil && token.Type == "universal-auth-token" {
|
||||
authParams.UniversalAuthAccessToken = token.Token
|
||||
}
|
||||
|
||||
secrets = util.ExpandSecrets(secrets, authParams, "")
|
||||
}
|
||||
|
||||
requestedSecrets := []models.SingleEnvironmentVariable{}
|
||||
|
||||
secretsMap := getSecretsByKeys(secrets)
|
||||
@@ -494,18 +505,6 @@ func getSecretsByNames(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
if shouldExpand {
|
||||
|
||||
authParams := models.ExpandSecretsAuthentication{}
|
||||
if token != nil && token.Type == "service-token" {
|
||||
authParams.InfisicalToken = token.Token
|
||||
} else if token != nil && token.Type == "universal-auth-token" {
|
||||
authParams.UniversalAuthAccessToken = token.Token
|
||||
}
|
||||
|
||||
requestedSecrets = util.ExpandSecrets(requestedSecrets, authParams, "")
|
||||
}
|
||||
|
||||
if showOnlyValue && len(requestedSecrets) > 1 {
|
||||
util.PrintErrorMessageAndExit("--raw-value only works with one secret.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user