Skip to content

Commit

Permalink
Merge pull request #500 from sputn1ck/no_ui
Browse files Browse the repository at this point in the history
multi: add support for building without UI
  • Loading branch information
guggero authored Aug 14, 2024
2 parents 303312c + bc0bc68 commit 2588b83
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
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

0 comments on commit 2588b83

Please sign in to comment.