Skip to content
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

Enhance btcd/btcutil's appDataDir to support a CLI flag to programatically obtain config-directory path #2190

Open
dstadulis opened this issue May 28, 2024 · 2 comments

Comments

@dstadulis
Copy link

dstadulis commented May 28, 2024

Background / Motivation

Currently daemons using btcutil (litd, loop, pool, tapd, lnd) have operating-system specific configuration directory paths.

  1. Anytime guides are written or the conf file needs to addressed, there's a need to preface where these files are located https://github.com/lightninglabs/lightning-terminal/blob/ba81aaf0d797844efc72a20dcdb71edc9d5b4a9b/doc/config-lnd-remote.md?plain=1#L27-L32
Create a `lit.conf` file. The default location LiT will look for the configuration file
depends on your operating system:

- MacOS: `~/Library/Application Support/Lit/lit.conf`
- Linux: `~/.lit/lit.conf`
- Windows: `~/AppData/Roaming/Lit/lit.conf`
  1. and sometimes guides are have incomplete / error-prone conf information
    https://github.com/lightninglabs/docs.lightning.engineering/blob/261a1b8ebce1b5d1d027eb7f98c391031b67d562/lightning-network-tools/lightning-terminal/run-litd.md?plain=1#L21-L22

User: This guide failed because I did what it said and litd didn't find the conf file (because the user wasn't on linux and didn't know the macOS conf location)

  1. Other node-automation services have to manage determining where to place the conf file e.g. produce uname bash scripts.

  2. If the lnd/litd process has been started with a --lnddir set at runtime, the conf file location won't match what's listed in the guides

Solution

A CLI flag which reports btcd/btcutil's appDataDir would enable programmatically obtaining the config-directory path

e.g. litd --conf-prefix
would return the configuration-file directory

Enabling programmatic access:

touch $(litd --conf-prefix)/lit.conf
# or
<<<"lnd-mode=remote" >> $(litd --conf-prefix)/lit.conf

If --conf-prefix is considered a departure from existing nomenclature standards, An alternative name might be --lnd-dir-prefix

Obviate the human in the loop to determine the location!

References

Homebrew uses a similar flag

$ brew --prefix

/opt/homebrew

and is often used

@dstadulis
Copy link
Author

If btcd isn't the ideal location for this issue, it will be moved

@dstadulis dstadulis changed the title Enhance btcd/btcutil's appDataDir to support a CLI flag to programatically obtain config-directory path Enhance btcd/btcutil's appDataDir to support a CLI flag to programatically obtain config-directory path May 28, 2024
@dstadulis
Copy link
Author

dstadulis commented May 28, 2024

the main pitch is:
Don't you want to live in a world where we can tell anyone, regardless of their OS:

Run this in your terminal
<<<"lnd-mode=remote" >> $(litd --conf-prefix)/lit.conf

Rather than

Ok if you are using linux <<<"lnd-mode=remote" >> ~/.lit/lit.conf oh you're on macOS? oh then you should do <<<"lnd-mode=remote" >> ~/Library/Application Support/Lit/lit.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant