From 32e769c9da1aa221819c9493892f6b7939fd52cc Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Tue, 15 Oct 2019 08:53:47 -0700 Subject: [PATCH] Moves custom config path into defaults.go from makefile --- Makefile | 8 +------- defaults.go | 7 ++++++- main.go | 6 ------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e5d651e..17e6b8f 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/defaults.go b/defaults.go index 93b25cc..8766005 100644 --- a/defaults.go +++ b/defaults.go @@ -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" diff --git a/main.go b/main.go index 1a8ff27..1189d77 100644 --- a/main.go +++ b/main.go @@ -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()