Documentation
¶
Overview ¶
Package config resolves the bbox command's settings: flags, then BBOX_* in the environment, then the config file, then the built-in default.
The deployment addresses have no default: the overlay hosts, the facade, the header source, the settlement leg, the node and the host a priced question goes to. A default there would quietly send a sender's envelopes or a reader's questions to somebody else's server, so a command that needs one and finds none is a usage error.
Index ¶
Constants ¶
const ( ModePlane = "plane" ModeUnicast = "unicast" QuorumAll = "all" QuorumMajority = "majority" QuorumOne = "one" )
The modes and the named quorums.
Variables ¶
var ErrUnknownKey = errors.New("config: unknown key")
ErrUnknownKey reports a key the grammar does not define.
var Keys = []string{"accept_payer_limit", "accept_threshold_sats", "accept_total_limit", "accept_watch", "accept_window", "arcade_key", "asset", "box", "facade", "header_url", "history_host", "home", "hosts", "mode", "network", "object_bound", "office", "originator", "quorum", "rpc", "rpc_pass", "rpc_user", "settle", "timeout", "tree_count"}
Keys is the file grammar's key list, in lexicographic order. 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 DefaultHome ¶
func DefaultHome() string
DefaultHome is ~/.bbox, or .bbox when there is no home directory.
func Need ¶
Need is how many of n hosts the quorum q requires. A number above n is an error: a quorum no host set can meet would refuse every publish.
Types ¶
type Config ¶
type Config struct {
// AcceptPayerLimit and AcceptTotalLimit bound the satoshis taken on
// the fast path and not yet mined, per payer and in all; zero is one
// and ten thresholds. AcceptThresholdSats is the largest payment taken
// on the network's acceptance; above it a payment waits for its block.
// AcceptWatch is how long to watch for a conflict before taking one
// fast, and AcceptWindow how long one counts against the limits unless
// it mines first (bcommon acceptance.Policy).
AcceptPayerLimit uint64
AcceptThresholdSats uint64
AcceptTotalLimit uint64
AcceptWatch time.Duration
AcceptWindow time.Duration
// ArcadeKey is the bearer token for an arcade installation in Settle.
ArcadeKey string
// Asset is the node's asset API base URL: proofs, the chain tip, blocks
// and raw transactions.
Asset string
// Box is the box an envelope goes to when send names none, and the
// box list and read ask about when they name none; empty asks about
// every box.
Box string
// Facade is the overlay host a publisher submits to in mode plane.
Facade string
// HeaderURL is the header source every proof is checked against: a
// bridge's /v1 base URL, woc:main, woc:test or chaintracks:URL. No
// default, ever.
HeaderURL string
// HistoryHost is the base URL of ls_bbox on the host a priced history
// question is asked of: the host's terms route (spec section 7.4).
HistoryHost string
// Home is the identity's directory: key, coin pool and state.
Home string
// Hosts are the overlay hosts a reader asks. In mode unicast they are
// every host a publisher submits to; in mode plane a sweep also goes
// to each of them directly.
Hosts []string
// Mode is how a publisher's objects reach the hosts: "plane" (one
// submit to Facade, which the plane delivers to every subscribed host)
// or "unicast" (one submit to each of Hosts).
Mode string
// Network is "main", "test" or "regtest": the fund address's prefix
// and the proof-of-work floor a header source is held to.
Network string
// ObjectBound is the largest object the plane takes, in bytes.
ObjectBound int
// Office is the office identifier <name>_<suffix> a command uses when
// it names none.
Office string
// Originator is the BRC-100 originator presented to the wallet.
Originator string
// Quorum is, in mode unicast, how many of Hosts must take an object
// for it to count as published: "all", "majority", "one" or a number.
Quorum string
// RPC is the node's JSON-RPC URL; RPCUser and RPCPass its basic auth.
RPC string
RPCPass string
RPCUser string
// Settle is the settlement leg mined transactions go to (funding
// trees, sweeps, payments a recipient internalizes): tcp:<host:port>,
// rpc:<url> or arcade:<url>.
Settle string
// Timeout bounds each request to a host, node or header source.
Timeout time.Duration
// TreeCount is how many outputs a new funding tree has.
TreeCount int
}
Config is the resolved settings.
func Load ¶
Load resolves the file (a missing one is fine) and the environment over the defaults. Flags are applied by the caller afterwards with Apply.
func (Config) AcceptPolicy ¶ added in v0.2.0
func (c Config) AcceptPolicy() acceptance.Policy
AcceptPolicy is the payment acceptance rule the settings name.