func Write(filename string, exclusive bool) error {
	flags := os.O_CREATE | os.O_WRONLY | os.O_TRUNC
	if exclusive {
		flags = os.O_CREATE | os.O_WRONLY | os.O_EXCL
	}
	return config.Write(filename, flags)
}
Write encodes and writes the config map to the specified file.

If exclusive is true an error will be returned if the file
already exists, otherwise it will truncate the file and write to it.
package config
import (
	"os"
	"path/filepath"
	"time"
	"github.com/awnumar/memguard"
	"github.com/pkg/errors"
	"github.com/spf13/cast"
)
func Init() error {
	configPath := os.Getenv("KURE_CONFIG")
	switch {
	case configPath != "":
		ext := filepath.Ext(configPath)
		if ext == "" || ext == "." {
			return errors.New("\"KURE_CONFIG\" environment variable must have an extension")
		}
	default:
		home, err := os.UserHomeDir()
		if err != nil {
			return errors.Wrap(err, "finding home directory")
		}
		home = filepath.Join(home, ".kure")
		if err := os.MkdirAll(home, 0700); err != nil {
			return errors.Wrap(err, "creating the directory")
		}
		configPath = filepath.Join(home, "kure.yaml")
		if _, err := os.Stat(configPath); err != nil {
			if os.IsNotExist(err) {
				SetDefaults(filepath.Join(home, "kure.db"))
				if err := Write(configPath, true); err != nil {
					return err
				}
			} else {
				return err
			}
		}
	}
	if err := Load(configPath); err != nil {
		return err
	}
	if IsSet("auth") {
		return errors.New("found invalid key: \"auth\"")
	}
	return nil
}
func FileUsed() string {
	return config.filename
}
func Get(key string) interface{} {
	return config.Get(key)
}
func GetEnclave(key string) *memguard.Enclave {
	v := config.Get(key)
	if v == nil {
		return nil
	}
	return v.(*memguard.Enclave)
}
func GetDuration(key string) time.Duration {
	return cast.ToDuration(config.Get(key))
}
func GetString(key string) string {
	return cast.ToString(config.Get(key))
}
func GetStringMapString(key string) map[string]string {
	return cast.ToStringMapString(config.Get(key))
}
func GetUint32(key string) uint32 {
	return cast.ToUint32(config.Get(key))
}
func IsSet(key string) bool {
	return config.Get(key) != nil
}
func Load(configPath string) error {
	return config.Load(configPath)
}
func Reset() {
	config = New()
}
func Set(key string, value interface{}) {
	config.Set(key, value)
}
func SetDefaults(dbPath string) {
	var defaults = map[string]interface{}{
		"clipboard.timeout": "0s",
		"database.path":     dbPath,
		"editor":            "vim",
		"keyfile.path":      "",
		"session.prefix":    "kure:~ $",
		"session.scripts":   map[string]string{},
		"session.timeout":   "0s",
	}
	for k, v := range defaults {
		Set(k, v)
	}
}
func SetFile(filename string) {
	config.filename = filename
}