Skip to content

Commit

Permalink
Make default config path configurable, add parameter in freebsd Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Sep 15, 2020
1 parent bdfd7e9 commit 9f7d600
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"syscall"
)

// ConfigPath is the default path to the configuration file
var ConfigPath = "/etc/grafsy/grafsy.toml"

// Config is the main config specified by user.
type Config struct {
// Supervisor manager which is used to run Grafsy. e.g. systemd.
Expand Down
5 changes: 3 additions & 2 deletions freebsd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PLIST_SUB= GRAFSY_USER=${GRAFSY_USER} \
GOPATH= ${WRKDIR}/gopath
GOSRC= github.com/${GH_ACCOUNT}/${PORTNAME}
GOCMD= ${SETENV} ${BUILD_ENV} GOCACHE=/tmp GOPATH=${GOPATH}
GOFLAGS= -ldflags "-X 'main.version=${PORTVERSION}-${PORTREVISION}' -X 'github.com/leoleovich/grafsy.ConfigPath=${GRAFSY_ETCDIR}/grafsy.toml'"

post-extract:
mkdir -p ${WRKDIR}/gopath/src/github.com/${GH_ACCOUNT}
Expand All @@ -56,8 +57,8 @@ post-extract:
${MV} ${WRKSRC_pkg_errors} ${GOPATH}/src/github.com/pkg/errors

do-build:
${GOCMD} go install ${GOSRC}/${PORTNAME}
${GOCMD} go install ${GOSRC}/${PORTNAME}-client
${GOCMD} go install ${GOFLAGS} ${GOSRC}/${PORTNAME}
${GOCMD} go install ${GOFLAGS} ${GOSRC}/${PORTNAME}-client

do-install:
${MKDIR} ${STAGEDIR}${GRAFSY_LOGDIR}
Expand Down
2 changes: 1 addition & 1 deletion grafsy-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {
fmt.Fprintf(os.Stderr, "\nArgs:\n")
flag.PrintDefaults()
}
flag.StringVar(&configFile, "c", "/etc/grafsy/grafsy.toml", "Path to config file.")
flag.StringVar(&configFile, "c", grafsy.ConfigPath, "Path to config file.")
flag.BoolVar(&printVersion, "v", printVersion, "Print version and exit")
flag.IntVar(&connectionTimeout, "w", 50, "Timeout ")
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion grafsy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var version = "dev"
func main() {
var configFile string
printVersion := false
flag.StringVar(&configFile, "c", "/etc/grafsy/grafsy.toml", "Path to config file.")
flag.StringVar(&configFile, "c", grafsy.ConfigPath, "Path to config file.")
flag.BoolVar(&printVersion, "v", printVersion, "Print version and exit")
flag.Parse()

Expand Down

0 comments on commit 9f7d600

Please sign in to comment.