Skip to content

Commit bc0bc68

Browse files
committed
multi: add support for building without UI
This commit adds support for building without UI. If the build tag "litd no_ui" is set the UI will be disabled.
1 parent 303312c commit bc0bc68

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,22 @@ go-build:
130130
$(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litd-debug $(PKG)/cmd/litd
131131
$(GOBUILD) -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litcli-debug $(PKG)/cmd/litcli
132132

133+
134+
go-build-noui:
135+
@$(call print, "Building lightning-terminal without UI.")
136+
$(GOBUILD) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litd-debug $(PKG)/cmd/litd
137+
$(GOBUILD) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" -o litcli-debug $(PKG)/cmd/litcli
138+
133139
go-install:
134140
@$(call print, "Installing lightning-terminal.")
135141
$(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litd
136142
$(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litcli
137143

144+
go-install-noui:
145+
@$(call print, "Installing lightning-terminal without UI.")
146+
$(GOINSTALL) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litd
147+
$(GOINSTALL) -tags="litd_no_ui $(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" $(PKG)/cmd/litcli
148+
138149
go-install-cli:
139150
@$(call print, "Installing all CLI binaries.")
140151
$(GOINSTALL) -trimpath -tags="$(LND_RELEASE_TAGS)" -ldflags "$(LDFLAGS)" github.com/lightningnetwork/lnd/cmd/lncli

app.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build !litd_no_ui
2+
// +build !litd_no_ui
3+
4+
package terminal
5+
6+
import (
7+
"embed"
8+
)
9+
10+
var (
11+
// appBuildFS is an in-memory file system that contains all the static
12+
// HTML/CSS/JS files of the UI. It is compiled into the binary with the
13+
// go 1.16 embed directive below. Because the path is relative to the
14+
// root package, all assets will have a path prefix of /app/build/ which
15+
// we'll strip by giving a sub directory to the HTTP server.
16+
//
17+
//go:embed app/build/*
18+
appBuildFS embed.FS
19+
)

app_noui.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build litd_no_ui
2+
// +build litd_no_ui
3+
4+
package terminal
5+
6+
import "embed"
7+
8+
var (
9+
appBuildFS embed.FS
10+
)

docs/release-notes/release-notes-0.13.4.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
- [Fixed a bug where REST calls for the `WalletUnlocker` service weren't allowed
88
on startup](https://github.com/lightninglabs/lightning-terminal/pull/806).
9+
- [Added build flag 'litd_no_ui' for building litd without the ui, accessible
10+
with 'make go-build-noui' and 'make go-install-noui'](https://github.com/lightninglabs/lightning-terminal/pull/500).
911

1012
### LND
1113

terminal.go

-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package terminal
33
import (
44
"context"
55
"crypto/tls"
6-
"embed"
76
"encoding/binary"
87
"encoding/hex"
98
"errors"
@@ -91,15 +90,6 @@ var (
9190
// the macaroon database before we give up with an error.
9291
macDatabaseOpenTimeout = time.Second * 5
9392

94-
// appBuildFS is an in-memory file system that contains all the static
95-
// HTML/CSS/JS files of the UI. It is compiled into the binary with the
96-
// go 1.16 embed directive below. Because the path is relative to the
97-
// root package, all assets will have a path prefix of /app/build/ which
98-
// we'll strip by giving a sub directory to the HTTP server.
99-
//
100-
//go:embed app/build/*
101-
appBuildFS embed.FS
102-
10393
// appFilesDir is the sub directory of the above build directory which
10494
// we pass to the HTTP server.
10595
appFilesDir = "app/build"

0 commit comments

Comments
 (0)