Documentation
¶
Overview ¶
Package config resolves bfinger's settings: flags, then BFINGER_* in the environment, then the config file, then the built-in default.
The overlay addresses have NO default: the host, the facade and the header source. The header source in particular is the egress control. A default there would quietly send verification questions to somebody else's server, so a missing value is a usage error. The chain view and the settlement leg default, on mainnet and testnet, to the public services that need no node (WhatsOnChain and GorillaPool's arcade); a node is an option for both.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownKey = errors.New("config: unknown key")
ErrUnknownKey reports a key the grammar does not define.
var Keys = []string{"home", "host", "header_url", "network", "facade", "settle", "rpc", "rpc_user", "rpc_pass", "asset", "topic", "known_keys", "timeout", "quorum", "originator", "wallet", "wallet_url", "funding", "proofs", "arcade_key",
"chain", "woc_key", "fund_unmined", "fee_rate", "fee_source", "fee_floor", "fee_dust", "fee_min_rate", "fee_max_rate", "fee_max_tx", "fee_policy_urls", "messagebox"}
Keys is the file grammar's key list, with the field each sets. A key not in it is an error: a misspelt key that was silently ignored would leave a setting at its default with no sign that the file was ever read.
Functions ¶
func DefaultHeaderURL ¶ added in v0.7.0
DefaultHeaderURL is the header source used when none is set: the public WhatsOnChain service for main and test, and none for regtest (a private chain has no public header service).
Types ¶
type Config ¶
type Config struct {
// Home is the state directory: known_keys, identity, pool, journal, state.
Home string
// Host is the overlay host base URL for lookups. Empty means resolve it
// from the domain's manifest (BRC-180).
Host string
// HeaderURL is the header source: woc:main, woc:test, chaintracks:URL, or
// a bridge's header read API base. Empty resolves to WhatsOnChain on the
// network (woc:main, woc:test; see DefaultHeaderURL); regtest has none.
HeaderURL string
// Network is the chain: "main" (the default), "test" or "regtest" (any
// private chain). It sets the proof-of-work floor a header must meet.
Network string
// Facade is the bridge facade base URL for publishing objects.
Facade string
// MessageBox is the BRC-33 message box server private store deliveries
// are sent through and taken from. Empty: deliveries are files.
MessageBox string
// Settle is the settlement leg, as publish.ParseSettler reads it:
// "arcade:main", "arcade:test" or "arcade:<url>" for an arcade
// installation, "arc:<url>" for an ARC one, "rpc:<url>" for a node with
// an acknowledgement, or "tcp:<host:port>" for the bare-EF ingress.
// Empty is the network's public arcade (publish.DefaultSettle).
Settle string
// ArcadeKey is the bearer token for an arcade installation that wants
// one. Only sent to the arcade URL in Settle.
ArcadeKey string
// Proofs is "wait" (a transition returns once its state token is mined
// and proven) or "async" (it returns once the network has accepted the
// token, and the proof is collected by a later command). Async needs a
// settlement leg that answers, which the bare-EF ingress does not.
Proofs string
// Chain is the chain view transactions, proofs and spends are read
// from, as nodeapi.ParseChain reads it: "woc:main", "woc:test",
// "asset:<url>" (a node), or a comma-separated list. Empty is Asset's
// node when one is configured, else WhatsOnChain on this network.
Chain string
// WoCKey is a WhatsOnChain API key, for a rate above the free one.
WoCKey string
// RPC and Asset are a node's endpoints: coinbase funding (regtest) and,
// for Asset, the chain view when Chain is unset ("asset:<Asset>").
RPC string
Asset string
// RPCUser and RPCPass are the node's basic-auth credentials.
RPCUser string
RPCPass string
// Topic is the topic both objects are published to.
Topic string
// KnownKeys is the pin store path.
KnownKeys string
Timeout time.Duration
// Quorum is how many hosts must answer identically; 1 asks one host.
Quorum int
// Originator is the BRC-100 originator string presented to the wallet.
Originator string
// Wallet is "embedded" (bfinger's own key and coin) or "wire" (a BRC-100
// wallet reached over the wallet wire at WalletURL).
Wallet string
// WalletURL is the wire wallet's base URL. Loopback only.
WalletURL string
// Funding is "home" (fees come from the coin in this home, and bfinger
// settles) or "wallet" (the wire wallet funds, signs and broadcasts
// every mined transaction through its action flow).
Funding string
// FundUnmined is "accept" (fund -beef takes a payment not mined yet
// whose parents are proven, held until its proof arrives) or "refuse".
FundUnmined string
// Fee is the miner fee configuration, over mint.DefaultFees.
Fee feepolicy.Config
}
Config is the resolved settings.
func Load ¶
Load resolves the file (missing is fine) and the environment over the defaults. Flags are applied by the caller afterwards, because only the caller knows which flags were actually set.