func findReplace(conf []byte, sep string, kv map[string]string) []byte {
	lines := strings.Split(string(conf), "\n")
	for k, v := range kv {
		found := false
		for i, l := range lines {
			if !strings.HasPrefix(l, "#") && strings.Contains(l, k) {
				lines[i] = fmt.Sprintf("%s%s%s", k, sep, v)
				found = true
			}
		}
		if !found {
			lines = append(lines, fmt.Sprintf("%s%s%s", k, sep, v))
		}
	}
	out := strings.Join(lines, "\n")
	return []byte(out)
}
Terribly inefficient way to find keys and replace them with
our own value... Refactor at a later point in time...
sep defines the separator (typically " ", ":" or "=")
This function uses exact (case-sensitive) match on purpose.
package lift
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	log "github.com/sirupsen/logrus"
)
const (
	START   = "start"
	RESTART = "restart"
	STOP    = "stop"
	RELOAD  = "reload"
	ZAP     = "zap"
)
func parseConfigFile(path, sep string, kv map[string]string) error {
	conf, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	out := findReplace(conf, sep, kv)
	err = ioutil.WriteFile(path, out, 0644)
	if err != nil {
		return err
	}
	return nil
}