func zipEnvvars(tempDir, hostname string) error {
	envvars := getAllowedEnvvars()

	var b bytes.Buffer
	if len(envvars) > 0 {
		fmt.Fprintln(&b, "Found the following envvars:")
		for _, envvar := range envvars {
			fmt.Fprintln(&b, " - ", envvar)
		}
	} else {
		fmt.Fprintln(&b, "Found no allowed envvar")
	}

	f := filepath.Join(tempDir, hostname, "envvars.log")
	w, err := NewRedactingWriter(f, os.ModePerm, true)
	if err != nil {
		return err
	}
	defer w.Close()

	_, err = w.Write(b.Bytes())
	return err
}
// zipEnvvars collects allowed envvars that can affect the agent's
// behaviour while not being handled by viper, in addition to the envvars handled by viper
zipEnvvars collects allowed envvars that can affect the agent's
behaviour while not being handled by viper, in addition to the envvars handled by viper
// zipEnvvars collects allowed envvars that can affect the agent ' s // behaviour while not being handled by viper in addition to the envvars handled by viper
func zipEnvvars(tempDir, hostname string) error {
	envvars := getAllowedEnvvars()
	var b bytes.Buffer
	if len(envvars) > 0 {
		fmt.Fprintln(&b, "Found the following envvars:")
		for _, envvar := range envvars {
			fmt.Fprintln(&b, " - ", envvar)
		}
	} else {
		fmt.Fprintln(&b, "Found no allowed envvar")
	}
	f := filepath.Join(tempDir, hostname, "envvars.log")
	w, err := NewRedactingWriter(f, os.ModePerm, true)
	if err != nil {
		return err
	}
	defer w.Close()
	_, err = w.Write(b.Bytes())
	return err
}
func zipEnvvars ( tempDir , hostname string ) error { envvars := getAllowedEnvvars ( ) var b bytes . Buffer if len ( envvars ) > 0 { fmt . Fprintln ( & b , " " ) for _ , envvar := range envvars { fmt . Fprintln ( & b , " " , envvar ) } } else { fmt . Fprintln ( & b , " " ) } f := filepath . Join ( tempDir , hostname , " " ) w , err := NewRedactingWriter ( f , os . ModePerm , true ) if err != nil { return err } defer w . Close ( ) _ , err = w . Write ( b . Bytes ( ) ) return err }
zipEnvvars collects allowed envvars that can affect the agent's
behaviour while not being handled by viper, in addition to the envvars handled by viper
zipEnvvars collects allowed envvars that can affect the agent ' s behaviour while not being handled by viper in addition to the envvars handled by viper