Skip to content

Commit d277e9c

Browse files
committed
Improve flag visibility
The main goal of this PR is to improve the flag visibility by document the usage within arkd. Now flags can be set with `--` syntax, while keeping compatibility with previous env var mechanic. Flags are defined by cli and viper has been removed. A comprehensive list of flags and its usage can be displayed as follows: ```bash NAME: arkd start - Starts the arkd server USAGE: arkd start [command options] OPTIONS: --datadir value Directory to store data (default: "/home/gustavo/.arkd") [$ARKD_DATADIR] --port value Port (public) to listen on (default: 7070) [$ARKD_PORT] --admin-port value Admin port (private) to listen on, fallback to service port if 0 (default: 7071) [$ARKD_ADMIN_PORT] --log-level value Logging level (0-6, where 6 is trace) (default: 4) [$ARKD_LOG_LEVEL] --session-duration value How long a batch session lasts (in seconds) before timing out once it started (default: 30) [$ARKD_SESSION_DURATION] --db-type value Database type (postgres, sqlite, badger) (default: "postgres") [$ARKD_DB_TYPE] --pg-db-url value Postgres connection url if ARKD_DB_TYPE is set to postgres [$ARKD_PG_DB_URL] --event-db-type value Event database type (postgres, badger) (default: "postgres") [$ARKD_EVENT_DB_TYPE] --pg-event-db-url value Postgres connection url if ARKD_EVENT_DB_TYPE is set to postgres [$ARKD_PG_EVENT_DB_URL] --tx-builder-type value Transaction builder type (default: "covenantless") [$ARKD_TX_BUILDER_TYPE] --live-store-type value Cache service type (redis, inmemory) (default: "redis") [$ARKD_LIVE_STORE_TYPE] --redis-url value Redis db connection url if ARKD_LIVE_STORE_TYPE is set to redis [$ARKD_REDIS_URL] --redis-num-of-retries value Maximum number of retries for Redis write operations in case of conflicts (default: 10) [$ARKD_REDIS_NUM_OF_RETRIES] --vtxo-tree-expiry value VTXO tree expiry in seconds (default: 604672 (~7 days)) [$ARKD_VTXO_TREE_EXPIRY] --unilateral-exit-delay value Unilateral exit delay in seconds (default: 86400 (~24 hours)) [$ARKD_UNILATERAL_EXIT_DELAY] --public-unilateral-exit-delay value Public unilateral exit delay in seconds (default: 86400 (~24 hours)) [$ARKD_PUBLIC_UNILATERAL_EXIT_DELAY] --boarding-exit-delay value Boarding exit delay in seconds (default: 7776000 (~3 months)) [$ARKD_BOARDING_EXIT_DELAY] --esplora-url value Esplora API URL (default: "https://blockstream.info/api") [$ARKD_ESPLORA_URL] --wallet-addr value The arkd wallet address to connect to in the form host:port [$ARKD_WALLET_ADDR] --signer-addr value The signer address to connect to in the form host:port (default: value of `ARKD_WALLET_ADDR`) [$ARKD_SIGNER_ADDR] --no-macaroons Disable Macaroons authentication (default: false) [$ARKD_NO_MACAROONS] --no-tls Disable TLS (default: true) [$ARKD_NO_TLS] --unlocker-type value Wallet unlocker type (env, file) to enable auto-unlock [$ARKD_UNLOCKER_TYPE] --unlocker-file-path value Path to unlocker file [$ARKD_UNLOCKER_FILE_PATH] --unlocker-password value Wallet unlocker password [$ARKD_UNLOCKER_PASSWORD] --round-max-participants-count value Maximum number of participants per round (default: 128) [$ARKD_ROUND_MAX_PARTICIPANTS_COUNT] --round-min-participants-count value Minimum number of participants per round (default: 1) [$ARKD_ROUND_MIN_PARTICIPANTS_COUNT] --utxo-max-amount value The maximum allowed amount for boarding or collaborative exit (default: -1 unset) [$ARKD_UTXO_MAX_AMOUNT] --utxo-min-amount value The minimum allowed amount for boarding or collaborative exit (default: -1 dust) [$ARKD_UTXO_MIN_AMOUNT] --vtxo-max-amount value The maximum allowed amount for vtxos (default: -1 unset) [$ARKD_VTXO_MAX_AMOUNT] --vtxo-min-amount value The minimum allowed amount for vtxos (default: -1 dust) [$ARKD_VTXO_MIN_AMOUNT] --ban-duration value Ban duration in seconds (default: 300) [$ARKD_BAN_DURATION] --ban-threshold value Number of crimes to trigger a ban (default: 3) [$ARKD_BAN_THRESHOLD] --scheduler-type value Scheduler type (gocron, block) (default: "gocron") [$ARKD_SCHEDULER_TYPE] --checkpoint-exit-delay value Checkpoint exit delay in seconds (default: 86400) [$ARKD_CHECKPOINT_EXIT_DELAY] --tls-extra-ip value [ --tls-extra-ip value ] Extra IP addresses for TLS (comma-separated) [$ARKD_TLS_EXTRA_IP] --tls-extra-domain value [ --tls-extra-domain value ] Extra domains for TLS (comma-separated) [$ARKD_TLS_EXTRA_DOMAIN] --note-uri-prexi value Note URI prefix [$ARKD_NOTE_URI_PREFIX] --scheduled-session-start-time value Scheduled session start time (Unix timestamp) (default: 0) [$ARKD_SCHEDULED_SESSION_START_TIME] --scheduled-session-end-time value Scheduled session end time (Unix timestamp) (default: 0) [$ARKD_SCHEDULED_SESSION_END_TIME] --scheduled-session-period value Scheduled session period in minutes (default: 0) [$ARKD_SCHEDULED_SESSION_PERIOD] --scheduled-session-duration value Scheduled session duration in seconds (default: 0) [$ARKD_SCHEDULED_SESSION_DURATION] --scheduled-session-min-round-participants-count value Min participants for scheduled sessions [$ARKD_SCHEDULED_SESSION_MIN_ROUND_PARTICIPANTS_COUNT] --scheduled-session-max-round-participants-count value Max participants for scheduled sessions [$ARKD_SCHEDULED_SESSION_MAX_ROUND_PARTICIPANTS_COUNT] --collector-endpoint value OpenTelemetry collector endpoint [$ARKD_COLLECTOR_ENDPOINT] --otel-push-internal value OpenTelemetry push interval in seconds (default: 10) [$ARKD_OTEL_PUSH_INTERVAL] --allow-csv-block-type Allow CSV block type (default: false) [$ARKD_ALLOW_CSV_BLOCK_TYPE] --heartbeat-interval value Heartbeat interval in seconds (default: 60) [$ARKD_HEARTBEAT_INTERVAL] --round-report-enabled Enable round report service (default: false) [$ARKD_ROUND_REPORT_ENABLED] --settlement-min-expiry-gap value (default: 0 disabled) [$ARKD_SETTLEMENT_MIN_EXPIRY_GAP] --vtxo-no-csv-validation-cutoff-date value (default: 0 disabled) [$ARKD_VTXO_NO_CSV_VALIDATION_CUTOFF_DATE] --onchain-output-fee value (default: 0) [$ARKD_ONCHAIN_OUTPUT_FEE] --alert-manager-url value [$ARKD_ALERT_MANAGER_URL] --help, -h show help ``` Closes #782 Signed-off-by: Gustavo Chain <[email protected]>
1 parent 7afe52a commit d277e9c

File tree

5 files changed

+501
-172
lines changed

5 files changed

+501
-172
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export ARKD_SIGNER_ADDR=localhost:7071
175175

176176
2. Start arkd:
177177
```sh
178-
arkd
178+
arkd start
179179
```
180180

181181
3. Create a new wallet:

cmd/arkd/commands.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/arkade-os/arkd/internal/config"
1213
"github.com/btcsuite/btcd/btcec/v2"
1314
"github.com/urfave/cli/v2"
1415
)
@@ -20,6 +21,7 @@ var (
2021
startCmd = &cli.Command{
2122
Name: "start",
2223
Usage: "Starts the arkd server",
24+
Flags: config.Flags,
2325
Action: startAction,
2426
}
2527

cmd/arkd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const (
2323
tlsCertFile = "cert.pem"
2424
)
2525

26-
func startAction(_ *cli.Context) error {
27-
cfg, err := config.LoadConfig()
26+
func startAction(c *cli.Context) error {
27+
cfg, err := config.LoadConfig(c)
2828
if err != nil {
2929
return fmt.Errorf("invalid config: %s", err)
3030
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ require (
4444
github.com/redis/go-redis/v9 v9.10.0
4545
github.com/shopspring/decimal v1.2.0
4646
github.com/sirupsen/logrus v1.9.3
47-
github.com/spf13/viper v1.20.1
4847
github.com/sqlc-dev/pqtype v0.3.0
4948
github.com/stretchr/testify v1.11.1
5049
github.com/timshannon/badgerhold/v4 v4.0.3
@@ -181,6 +180,7 @@ require (
181180
github.com/rogpeppe/fastuuid v1.2.0 // indirect
182181
github.com/russross/blackfriday/v2 v2.1.0 // indirect
183182
github.com/soheilhy/cmux v0.1.5 // indirect
183+
github.com/spf13/viper v1.20.1 // indirect
184184
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
185185
github.com/tidwall/gjson v1.17.3 // indirect
186186
github.com/tidwall/match v1.1.1 // indirect

0 commit comments

Comments
 (0)