mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 15:26:35 +00:00
fix: addressed type issue
This commit is contained in:
+12
-17
@@ -229,8 +229,16 @@ var secretsSetCmd = &cobra.Command{
|
|||||||
secretsToModify := []api.Secret{}
|
secretsToModify := []api.Secret{}
|
||||||
secretOperations := []SecretSetOperation{}
|
secretOperations := []SecretSetOperation{}
|
||||||
|
|
||||||
secretByKey := getSecretsByKeys(secrets)
|
sharedSecretMapByName := make(map[string]models.SingleEnvironmentVariable, len(secrets))
|
||||||
personalSecretByKey := getPersonalSecretsByKeys(secrets)
|
personalSecretMapByName := make(map[string]models.SingleEnvironmentVariable, len(secrets))
|
||||||
|
|
||||||
|
for _, secret := range secrets {
|
||||||
|
if secret.Type == util.SECRET_TYPE_PERSONAL {
|
||||||
|
personalSecretMapByName[secret.Key] = secret
|
||||||
|
} else {
|
||||||
|
sharedSecretMapByName[secret.Key] = secret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
splitKeyValueFromArg := strings.SplitN(arg, "=", 2)
|
splitKeyValueFromArg := strings.SplitN(arg, "=", 2)
|
||||||
@@ -262,9 +270,9 @@ var secretsSetCmd = &cobra.Command{
|
|||||||
var doesSecretExist bool
|
var doesSecretExist bool
|
||||||
|
|
||||||
if secretType == util.SECRET_TYPE_SHARED {
|
if secretType == util.SECRET_TYPE_SHARED {
|
||||||
existingSecret, doesSecretExist = secretByKey[key]
|
existingSecret, doesSecretExist = sharedSecretMapByName[key]
|
||||||
} else {
|
} else {
|
||||||
existingSecret, doesSecretExist = personalSecretByKey[key]
|
existingSecret, doesSecretExist = personalSecretMapByName[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
if doesSecretExist {
|
if doesSecretExist {
|
||||||
@@ -780,19 +788,6 @@ func getSecretsByKeys(secrets []models.SingleEnvironmentVariable) map[string]mod
|
|||||||
return secretMapByName
|
return secretMapByName
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPersonalSecretsByKeys(secrets []models.SingleEnvironmentVariable) map[string]models.SingleEnvironmentVariable {
|
|
||||||
secretMapByName := make(map[string]models.SingleEnvironmentVariable, len(secrets))
|
|
||||||
|
|
||||||
for _, secret := range secrets {
|
|
||||||
if secret.Type == util.SECRET_TYPE_PERSONAL {
|
|
||||||
secretMapByName[secret.Key] = secret
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return secretMapByName
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
secretsGenerateExampleEnvCmd.Flags().String("token", "", "Fetch secrets using the Infisical Token")
|
secretsGenerateExampleEnvCmd.Flags().String("token", "", "Fetch secrets using the Infisical Token")
|
||||||
secretsGenerateExampleEnvCmd.Flags().String("projectId", "", "manually set the projectId to fetch folders from for machine identity")
|
secretsGenerateExampleEnvCmd.Flags().String("projectId", "", "manually set the projectId to fetch folders from for machine identity")
|
||||||
|
|||||||
Reference in New Issue
Block a user