diff --git a/internal/hub/debug.go b/internal/hub/debug.go new file mode 100644 index 000000000..6f42ab426 --- /dev/null +++ b/internal/hub/debug.go @@ -0,0 +1,17 @@ +//go:build debug +// +build debug + +package hub + +import ( + "os" + + "github.com/photoprism/photoprism/pkg/clean" +) + +func init() { + if debugUrl := os.Getenv("PHOTOPRISM_HUB_URL"); debugUrl != "" { + log.Infof("config: set hub url to %s", clean.Log(debugUrl)) + ServiceURL = debugUrl + } +} diff --git a/scripts/build.sh b/scripts/build.sh index e2aa0150a..66266fb82 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,9 +20,9 @@ GO_VER=$($GO_BIN version) echo "Building PhotoPrism ${BUILD_ID} ($1)…" if [[ $1 == "debug" ]]; then - BUILD_CMD=("$GO_BIN" build -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go) + BUILD_CMD=("$GO_BIN" build -tags=debug -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go) elif [[ $1 == "race" ]]; then - BUILD_CMD=("$GO_BIN" build -race -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go) + BUILD_CMD=("$GO_BIN" build -tags=debug -race -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go) elif [[ $1 == "static" ]]; then BUILD_CMD=("$GO_BIN" build -a -v -ldflags "-linkmode external -extldflags \"-static -L /usr/lib -ltensorflow\" -s -w -X main.version=${BUILD_ID}" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go) else