Make runtime paths configurable at build time
To allow more build-time configuration: - `Makefile` will now pick up `LDFLAGS` from environment variables, and - locations of configuration files can now be overridden with linker options. These are not used for regular Flamenco builds, but do allow studios to customize where configuration files are stored. Review: https://projects.blender.org/studio/flamenco/pulls/104200
This commit is contained in:
parent
922e772efa
commit
f6f1ebdd05
2
Makefile
2
Makefile
@ -17,7 +17,7 @@ _GIT_DESCRIPTION_OR_TAG := $(subst v${VERSION}-,,$(shell git describe --tag --di
|
||||
# ${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.
|
||||
// This can be overruled at runtime by setting the FLAMENCO_HOME enviroment variable.
|
||||
// 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.
|
||||
// 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 (
|
||||
// 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
Block a user