Make runtime paths configurable at link time #104200
2
Makefile
2
Makefile
|
@ -17,7 +17,7 @@ _GIT_DESCRIPTION_OR_TAG := $(subst v${VERSION}-,,$(shell git describe --dirty --
|
|||
# ${GITHASH}.
|
||||
GITHASH := $(subst v${VERSION},$(shell git rev-parse --short HEAD),${_GIT_DESCRIPTION_OR_TAG})
|
||||
|
||||
LDFLAGS := -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} \
|
||||
LDFLAGS := ${LDFLAGS} -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} \
|
||||
-X ${PKG}/internal/appinfo.ApplicationGitHash=${GITHASH} \
|
||||
-X ${PKG}/internal/appinfo.ReleaseCycle=${RELEASE_CYCLE}
|
||||
BUILD_FLAGS = -ldflags="${LDFLAGS}"
|
||||
|
|
|
@ -10,10 +10,18 @@ import (
|
|||
"github.com/adrg/xdg"
|
||||
)
|
||||
|
||||
// customHome can be set at link time to specify the home directory for the worker.
|
||||
ZedDB marked this conversation as resolved
Outdated
|
||||
// This can be overruled at runtime by setting the FLAMENCO_HOME enviroment variable.
|
||||
ZedDB marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
Add that this is used in Add that this is used in `InFlamencoHome()` and is still overruled if the `FLAMENCO_HOME` environment variable is set.
|
||||
// Only used in InFlamencoHome() function.
|
||||
var customHome = ""
|
||||
|
||||
// InFlamencoHome returns the filename in the 'flamenco home' dir, and ensures
|
||||
// that the directory exists.
|
||||
func InFlamencoHome(filename string) (string, error) {
|
||||
flamencoHome := os.Getenv("FLAMENCO_HOME")
|
||||
flamencoHome := customHome
|
||||
if envHome, ok := os.LookupEnv("FLAMENCO_HOME"); ok {
|
||||
flamencoHome = envHome
|
||||
}
|
||||
if flamencoHome == "" {
|
||||
return xdg.DataFile(path.Join(xdgApplicationName, filename))
|
||||
}
|
||||
|
|
|
@ -25,9 +25,12 @@ import (
|
|||
shaman_config "git.blender.org/flamenco/pkg/shaman/config"
|
||||
)
|
||||
|
||||
const (
|
||||
configFilename = "flamenco-manager.yaml"
|
||||
// configFilename is used to specify where flamenco will write its config file.
|
||||
ZedDB marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
Document why this is a variable, and that it's not intended to be changed while Flamenco Manager is running. Document why this is a variable, and that it's not intended to be changed while Flamenco Manager is running.
|
||||
// If the path is not absolute, it will use the flamenco binary location as the
|
||||
// relative root path. This is not intended to be changed during runtime.
|
||||
var configFilename = "flamenco-manager.yaml"
|
||||
|
||||
const (
|
||||
latestConfigVersion = 3
|
||||
|
||||
// // relative to the Flamenco Server Base URL:
|
||||
|
|
|
@ -22,7 +22,11 @@ var (
|
|||
errURLWithoutHostName = errors.New("manager URL should contain a host name")
|
||||
)
|
||||
|
||||
const (
|
||||
var (
|
||||
ZedDB marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
Same comment as above. Same comment as above.
|
||||
// config- and credentialsFilename are used to specify where flamenco will
|
||||
// write its config/credentials file. If the path is not absolute, it will
|
||||
// use the flamenco binary location as the relative root path. These are not
|
||||
// intended to be changed during runtime.
|
||||
credentialsFilename = "flamenco-worker-credentials.yaml"
|
||||
configFilename = "flamenco-worker.yaml"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Replace
This variable can be set
with the actual name of the variable,customHome can be set
Also remove the "manually", as this can be done in an automated fashion as well.