diff --git a/Makefile b/Makefile index 7ee92e1f6..959083522 100644 --- a/Makefile +++ b/Makefile @@ -130,11 +130,22 @@ go-build: $(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litd-debug $(PKG)/cmd/litd $(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litcli-debug $(PKG)/cmd/litcli + +go-build-noui: + @$(call print, "Building lightning-terminal without UI.") + $(GOBUILD) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litd-debug $(PKG)/cmd/litd + $(GOBUILD) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litcli-debug $(PKG)/cmd/litcli + go-install: @$(call print, "Installing lightning-terminal.") $(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litd $(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litcli +go-install-noui: + @$(call print, "Installing lightning-terminal without UI.") + $(GOINSTALL) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litd + $(GOINSTALL) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litcli + go-install-cli: @$(call print, "Installing all CLI binaries.") $(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" github.com/lightningnetwork/lnd/cmd/lncli diff --git a/app.go b/app.go new file mode 100644 index 000000000..846e20d27 --- /dev/null +++ b/app.go @@ -0,0 +1,19 @@ +//go:build !litd_no_ui +// +build !litd_no_ui + +package terminal + +import ( + "embed" +) + +var ( + // appBuildFS is an in-memory file system that contains all the static + // HTML/CSS/JS files of the UI. It is compiled into the binary with the + // go 1.16 embed directive below. Because the path is relative to the + // root package, all assets will have a path prefix of /app/build/ which + // we'll strip by giving a sub directory to the HTTP server. + // + //go:embed app/build/* + appBuildFS embed.FS +) diff --git a/app_noui.go b/app_noui.go new file mode 100644 index 000000000..fdbc704fb --- /dev/null +++ b/app_noui.go @@ -0,0 +1,10 @@ +//go:build litd_no_ui +// +build litd_no_ui + +package terminal + +import "embed" + +var ( + appBuildFS embed.FS +) diff --git a/docs/release-notes/release-notes-0.13.4.md b/docs/release-notes/release-notes-0.13.4.md index c49b758f8..dce0cd78f 100644 --- a/docs/release-notes/release-notes-0.13.4.md +++ b/docs/release-notes/release-notes-0.13.4.md @@ -6,6 +6,8 @@ - [Fixed a bug where REST calls for the `WalletUnlocker` service weren't allowed on startup](https://github.com/lightninglabs/lightning-terminal/pull/806). +- [Added build flag 'litd_no_ui' for building litd without the ui, accessible +with 'make go-build-noui' and 'make go-install-noui'](https://github.com/lightninglabs/lightning-terminal/pull/500). ### LND diff --git a/terminal.go b/terminal.go index 23863cb37..a474e124a 100644 --- a/terminal.go +++ b/terminal.go @@ -3,7 +3,6 @@ package terminal import ( "context" "crypto/tls" - "embed" "encoding/binary" "encoding/hex" "errors" @@ -91,15 +90,6 @@ var ( // the macaroon database before we give up with an error. macDatabaseOpenTimeout = time.Second * 5 - // appBuildFS is an in-memory file system that contains all the static - // HTML/CSS/JS files of the UI. It is compiled into the binary with the - // go 1.16 embed directive below. Because the path is relative to the - // root package, all assets will have a path prefix of /app/build/ which - // we'll strip by giving a sub directory to the HTTP server. - // - //go:embed app/build/* - appBuildFS embed.FS - // appFilesDir is the sub directory of the above build directory which // we pass to the HTTP server. appFilesDir = "app/build"