func toJSONConfigurationService(values []settings.SettingValue) types.JSONConfigurationService {
	var cfg types.JSONConfigurationService
	for _, v := range values {
		if v.Name == settings.JSONListener {
			cfg.Listener = v.String
		}
		if v.Name == settings.JSONPort {
			cfg.Port = v.String
		}
		if v.Name == settings.JSONHost {
			cfg.Host = v.String
		}
		if v.Name == settings.JSONAuth {
			cfg.Auth = v.String
		}
		if v.Name == settings.JSONLogging {
			cfg.Logging = strings.Split(v.String, ",")
		}
	}
	return cfg
}
Helper to calculate the osquery config_hash and skip sending a blob that won't change anything
https://github.com/facebook/osquery/blob/master/osquery/config/config.cpp#L911
osquery calculates the SHA1 of the configuration blob, then the SHA1 hash of that
/*
func generateOsqueryConfigHash(config string) string {
firstHasher := sha1.New()
secondHasher := sha1.New()
Get SHA1 of configuration blob
_, _ = firstHasher.Write([]byte(config))
Get SHA1 of the first hash
_, _ = secondHasher.Write([]byte(hex.EncodeToString(firstHasher.Sum(nil))))
return hex.EncodeToString(secondHasher.Sum(nil))
}

Helper to convert from settings values to JSON configuration
package main
import (
	"bytes"
	"crypto/rand"
	"encoding/json"
	"flag"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"strings"
	"github.com/jmpsec/osctrl/settings"
	"github.com/jmpsec/osctrl/types"
)
func generateCSRF() string {
	b := make([]byte, 16)
	_, _ = rand.Read(b)
	return fmt.Sprintf("%x", b)
}
func removeBackslash(rawString string) string {
	return strings.Replace(rawString, "\\", " ", -1)
}
func queryResultLink(name string) (string, string) {
	defaultLink := strings.Replace(settings.QueryLink, "{{NAME}}", removeBackslash(name), 1)
	dbLink := strings.Replace(settingsmgr.QueryResultLink(), "{{NAME}}", removeBackslash(name), 1)
	return defaultLink, dbLink
}
func statusLogsLink(uuid string) string {
	return strings.Replace(settingsmgr.StatusLogsLink(), "{{UUID}}", removeBackslash(uuid), 1)
}
func resultLogsLink(uuid string) string {
	return strings.Replace(settingsmgr.ResultLogsLink(), "{{UUID}}", removeBackslash(uuid), 1)
}