Moves custom config path into defaults.go from makefile
This commit is contained in:
parent
6609cca70e
commit
32e769c9da
8
Makefile
8
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:
|
||||
|
|
|
@ -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"
|
||||
|
|
6
main.go
6
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()
|
||||
|
|
Loading…
Reference in New Issue