fix: "Injecting..." status stirng can be omitted by log levels

When using `infisical run`, I am often running another command
that needs to be processed or consumed by another; such as:

infisical run -- supabase status -o env

The Injecting string was being printed directly to stdout and
stopping such scripting from being successful, without further
adding tail -n+2.

This change defaults the output to the INFO logging level, which
means the behaviour is the exact same for everything; however
those who wish can omit this output with -l error|fatal
This commit is contained in:
David Flanagan
2023-12-10 16:13:38 +00:00
parent aabd896c37
commit 544d37bbc4

View File

@@ -204,7 +204,8 @@ func init() {
func executeSingleCommandWithEnvs(args []string, secretsCount int, env []string) error {
command := args[0]
argsForCommand := args[1:]
color.Green("Injecting %v Infisical secrets into your application process", secretsCount)
log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount))
cmd := exec.Command(command, argsForCommand...)
cmd.Stdin = os.Stdin
@@ -232,7 +233,7 @@ func executeMultipleCommandWithEnvs(fullCommand string, secretsCount int, env []
cmd.Stderr = os.Stderr
cmd.Env = env
color.Green("Injecting %v Infisical secrets into your application process", secretsCount)
log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount))
log.Debug().Msgf("executing command: %s %s %s \n", shell[0], shell[1], fullCommand)
return execCmd(cmd)