Documentation
¶
Overview ¶
Package config resolves the blogs command's settings: flags, then BLOGS_* 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 and the node. A default there would quietly send a producer's objects 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.
const DefaultObjectBound = 1 << 20
DefaultObjectBound is the object bound assumed when none is configured.
Variables ¶
var ErrUnknownKey = errors.New("config: unknown key")
ErrUnknownKey reports a key the grammar does not define.
var Keys = []string{"arcade_key", "asset", "facade", "header_url", "home", "hosts", "mode", "network", "object_bound", "originator", "quorum", "rpc", "rpc_pass", "rpc_user", "settle", "timeout", "tx_source"}
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 ~/.blogs, or .blogs when there is no home directory.
func Need ¶
Need is how many of n hosts the quorum q requires. q is one Apply accepted; a number above n is an error, because a quorum no host set can meet would refuse every publish.
Types ¶
type Config ¶
type Config struct {
// 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
// Facade is the overlay host a producer publishes to.
Facade string
// HeaderURL is the header source every proof a reader checks is checked
// against: a bridge's /v1 base URL, woc:main, woc:test or
// chaintracks:URL. No default, ever.
HeaderURL string
// Home is the producer's directory: identity, coin pool and streams.
Home string
// Hosts are the overlay hosts a reader asks, in order. In unicast mode
// they are also every host a producer submits to.
Hosts []string
// Mode is how a producer's objects reach the hosts: "plane" (one
// submit to Facade, which the multicast plane delivers to every
// subscribed host) or "unicast" (one submit to each of Hosts).
Mode string
// Network is "main", "test" or "regtest". It picks 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: a
// carrier's BEEF over it is not published.
ObjectBound int
// Originator is the BRC-100 originator presented to the wallet.
Originator string
// Quorum is, in unicast mode, 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: tcp:<host:port>, rpc:<url> or
// arcade:<url>.
Settle string
// Timeout bounds each request to a host, node or header source.
Timeout time.Duration
// TxSource is where a reader with no node (no Asset) reads the funding
// trees an anchor spends: "woc:main" or "woc:test", the public
// WhatsOnChain API. Its answers are held to the txid, and a proof to
// the header source, so it is trusted with nothing.
TxSource string
}
Config is the resolved settings.