Moves custom config path into defaults.go from makefile

This commit is contained in:
Brian Evans 2019-10-15 08:53:47 -07:00
parent 6609cca70e
commit 32e769c9da
3 changed files with 7 additions and 14 deletions

View File

@ -15,13 +15,7 @@ ifndef VERSION
VERSION := ${shell cat ./VERSION}
endif
# If an alternate configuration path is provided when make is run,
# include it as an ldflag
ifdef CONF_PATH
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME} -X main.conf_path=${CONF_PATH}"
else
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}"
endif
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}"
.PHONY: test
test:

View File

@ -12,11 +12,16 @@ var defaultOptions = map[string]string{
// Edit these values before compile to have different default values
// ... though they can always be edited from within bombadillo as well
// it just may take more time/work.
//
// To change the default location for the config you can enter
// any valid path as a string, if you want an absolute, or
// concatenate with the main default: `userinfo.HomeDir` like so:
// "configlocation": userinfo.HomeDir + "/config/"
"homeurl": "gopher://bombadillo.colorfield.space:70/1/user-guide.map",
"savelocation": userinfo.HomeDir,
"searchengine": "gopher://gopher.floodgap.com:70/7/v2/vs",
"openhttp": "false",
"httpbrowser": "lynx",
"httpbrowser": "",
"telnetcommand": "telnet",
"configlocation": userinfo.HomeDir,
"theme": "normal", // "normal", "inverted"

View File

@ -34,7 +34,6 @@ import (
var version string
var build string
var conf_path string
var bombadillo *client
var helplocation string = "gopher://bombadillo.colorfield.space:70/1/user-guide.map"
@ -97,11 +96,6 @@ func lowerCaseOpt(opt, val string) string {
}
func loadConfig() error {
// If a compile time override exists for configlocation
// set it before loading the config.
if conf_path != "" {
bombadillo.Options["configlocation"] = conf_path
}
file, err := os.Open(bombadillo.Options["configlocation"] + "/.bombadillo.ini")
if err != nil {
err = saveConfig()