aperture: always create admin macaroon on startup#227
Open
lightninglabs-deploy wants to merge 2 commits into
Open
aperture: always create admin macaroon on startup#227lightninglabs-deploy wants to merge 2 commits into
lightninglabs-deploy wants to merge 2 commits into
Conversation
added 2 commits
March 26, 2026 20:18
Previously, the admin macaroon and root key were only created when the admin dashboard was explicitly enabled via `admin.enabled: true` in the config. This meant that `aperturecli` could not authenticate unless the dashboard was also turned on, even though the CLI and the dashboard are independent features. Extract macaroon/root-key initialization into a new `initAdminMacaroon` function that runs unconditionally during startup. The admin gRPC/REST API is now always active (when the transaction store is available), while the embedded dashboard remains gated on `admin.enabled`.
WrapCLIError stores inner.Error() as Message and also keeps Inner. When Error() formats the output as "Message: Inner", the same string is printed twice. Guard the concatenation so that when Message already equals Inner.Error(), only one copy is returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
admin.enabledis set. Previously,apertureclicouldn't authenticate unless the dashboard was explicitly enabled, even though the CLI and dashboard are independent features.admin.enabledconfig flag now only gates the embedded dashboard UI.WrapCLIErrorwas setting bothMessageandInnerto the same error, causingError()to print the same string twice (e.g.unable to read macaroon: ...: unable to read macaroon: ...).Details
The root cause of the reported error:
...was that
admin.macaroonwas only written insidecreateAdminServer, which returned early whenadmin.enabledwas false.This PR extracts macaroon initialization into a new
initAdminMacaroonfunction called unconditionally inStart(), and refactorscreateAdminServerto accept the pre-createdrootKeyas a parameter.Test plan
go build ./...passesgo test ./...passes (one pre-existing flaky test inlncpackage unrelated to this change)aperturecliworks withoutadmin.enabledin configadmin.enabled: true