Skip to content

multi: add support for building without UI #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
@@ -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
)
10 changes: 10 additions & 0 deletions app_noui.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build litd_no_ui
// +build litd_no_ui

package terminal

import "embed"

var (
appBuildFS embed.FS
)
2 changes: 2 additions & 0 deletions docs/release-notes/release-notes-0.13.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 0 additions & 10 deletions terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package terminal
import (
"context"
"crypto/tls"
"embed"
"encoding/binary"
"encoding/hex"
"errors"
Expand Down Expand Up @@ -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"
Expand Down
Loading