Documentation
¶
Overview ¶
Package config encapsulates qri configuration options & details. configuration is generally stored as a .yaml file, or provided at CLI runtime via command a line argument
Index ¶
- Constants
- Variables
- func DefaultFilesystems() []qfs.Config
- func ImmutablePaths() map[string]bool
- type API
- type CLI
- type Config
- func (cfg *Config) Copy() *Config
- func (cfg Config) Get(path string) (interface{}, error)
- func (cfg Config) Path() string
- func (cfg *Config) Set(path string, value interface{}) error
- func (cfg *Config) SetArbitrary(key string, val interface{}) error
- func (cfg *Config) SetPath(path string)
- func (cfg Config) SummaryString() (summary string)
- func (cfg Config) Validate() error
- func (cfg *Config) WithPrivateValues(p *Config) *Config
- func (cfg *Config) WithoutPrivateValues() *Config
- func (cfg Config) WriteToFile(path string) error
- type Logging
- type P2P
- type ProfilePod
- type RPC
- type Registry
- type Remote
- type Remotes
- type Repo
- type Stats
Constants ¶
const CurrentConfigRevision = 2
CurrentConfigRevision is the latest configuration revision configurations that don't match this revision number should be migrated up
Variables ¶
var DefaultAPIAddress = fmt.Sprintf("/ip4/127.0.0.1/tcp/%s", DefaultAPIPort)
DefaultAPIAddress is the address the webapp serves on by default
var DefaultAPIPort = "2503"
DefaultAPIPort is the port the webapp serves on by default
var DefaultAPIWebsocketAddress = "/ip4/127.0.0.1/tcp/2506"
DefaultAPIWebsocketAddress is the websocket address the webapp serves on by default
var DefaultRPCAddress = "/ip4/127.0.0.1/tcp/2504"
DefaultRPCAddress is the address RPC serves on by default
Functions ¶
func DefaultFilesystems ¶ added in v0.9.9
DefaultFilesystems is the default filesystem stack
func ImmutablePaths ¶
ImmutablePaths returns a map of paths that should never be modified
Types ¶
type API ¶
type API struct {
// APIAddress specifies the multiaddress to listen for JSON API calls
Address string `json:"address"`
// API is enabled
Enabled bool `json:"enabled"`
// read-only mode
ReadOnly bool `json:"readonly"`
// Time in seconds to stop the server after,
// default 0 means keep alive indefinitely
DisconnectAfter int `json:"disconnectafter,omitempty"`
// support CORS signing from a list of origins
AllowedOrigins []string `json:"allowedorigins"`
// whether to allow requests from addresses other than localhost
ServeRemoteTraffic bool `json:"serveremotetraffic"`
// WebsocketAddress specifies the multiaddress to listen for websocket
WebsocketAddress string `json:"websocketaddress"`
// DisableWebui when true stops qri from serving the webui when the node is online
// TODO (ramfox): when we next have a config migration, we should probably rename this to
// EnableWebui and default to true. the double negative here can be confusing.
DisableWebui bool `json:"disablewebui"`
}
API holds configuration for the qri JSON api
func (*API) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type CLI ¶
type CLI struct {
ColorizeOutput bool `json:"colorizeoutput"`
}
CLI defines configuration details for the qri command line client (CLI)
func (*CLI) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
func (*CLI) WithPrivateValues ¶ added in v0.3.2
WithPrivateValues returns a deep copy of CLI struct all the privates values of the receiver added to the *CLI param
func (*CLI) WithoutPrivateValues ¶ added in v0.3.2
WithoutPrivateValues returns a deep copy of an CLI struct with all the private values removed
type Config ¶
type Config struct {
Revision int
Profile *ProfilePod
Repo *Repo
Filesystems []qfs.Config
P2P *P2P
Stats *Stats
Registry *Registry
Remotes *Remotes
Remote *Remote
CLI *CLI
API *API
RPC *RPC
Logging *Logging
// contains filtered or unexported fields
}
Config encapsulates all configuration details for qri
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig gives a new configuration with simple, default settings
func DefaultConfigForTesting ¶ added in v0.5.2
func DefaultConfigForTesting() *Config
DefaultConfigForTesting constructs a config with precomputed keys, only used for testing.
func ReadFromFile ¶
ReadFromFile reads a YAML configuration file from path
func (*Config) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
func (Config) SummaryString ¶
SummaryString creates a pretty string summarizing the configuration, useful for log output TODO (b5): this summary string doesn't confirm these services are actually running. we should move this elsewhere
func (Config) Validate ¶
Validate validates each section of the config struct, returning the first error
func (*Config) WithPrivateValues ¶ added in v0.3.2
WithPrivateValues returns a deep copy of the receiver with the private values from the *Config passed in from the params
func (*Config) WithoutPrivateValues ¶ added in v0.3.2
WithoutPrivateValues returns a deep copy of the receiver with the private values removed
func (Config) WriteToFile ¶
WriteToFile encodes a configration to YAML and writes it to path
type Logging ¶
type Logging struct {
// Levels is a map of package_name : log_level (one of [info, error, debug, warn])
Levels map[string]string `json:"levels"`
}
Logging encapsulates logging configuration
func DefaultLogging ¶
func DefaultLogging() *Logging
DefaultLogging produces a new default logging configuration
func (*Logging) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type P2P ¶
type P2P struct {
// Enabled is a flag for weather this node should connect
// to the distributed network
Enabled bool `json:"enabled"`
// PeerID is this nodes peer identifier
PeerID string `json:"peerid"`
PrivKey string `json:"privkey"`
// Port default port to bind a tcp listener to
// ignored if Addrs is supplied
Port int `json:"port"`
// List of multiaddresses to listen on
Addrs []ma.Multiaddr `json:"addrs"`
// QriBootstrapAddrs lists addresses to bootstrap qri node from
QriBootstrapAddrs []string `json:"qribootstrapaddrs"`
// list of addresses to bootsrap qri peers on
BootstrapAddrs []string `json:"bootstrapaddrs"`
// Enable AutoNAT service. unless you're hosting a server, leave this as false
AutoNAT bool `json:"autoNAT"`
}
P2P encapsulates configuration options for qri peer-2-peer communication
func DefaultP2P ¶
func DefaultP2P() *P2P
DefaultP2P generates a p2p struct with only bootstrap addresses set
func DefaultP2PForTesting ¶ added in v0.5.2
func DefaultP2PForTesting() *P2P
DefaultP2PForTesting constructs a p2p with precomputed keys, only used for testing.
func (*P2P) DecodePeerID ¶
DecodePeerID takes P2P.ID (a string), and decodes it into a peer.ID
func (*P2P) DecodePrivateKey ¶
DecodePrivateKey generates a PrivKey instance from base64-encoded config file bytes
func (*P2P) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type ProfilePod ¶ added in v0.3.2
type ProfilePod struct {
ID string `json:"id"`
PrivKey string `json:"privkey,omitempty"`
Peername string `json:"peername"`
// Created timestamp
Created time.Time `json:"created"`
// Updated timestamp
Updated time.Time `json:"updated"`
// specifies weather this is a user or an organization
Type string `json:"type"`
// user's email address
Email string `json:"email"`
// user name field. could be first[space]last, but not strictly enforced
Name string `json:"name"`
// user-filled description of self
Description string `json:"description"`
// url this user wants the world to click
HomeURL string `json:"homeurl"`
// color this user likes to use as their theme color
Color string `json:"color"`
// Thumb path for user's thumbnail
Thumb string `json:"thumb"`
// Profile photo
Photo string `json:"photo"`
// Poster photo for users's profile page
Poster string `json:"poster"`
// Twitter is a peer's twitter handle
Twitter string `json:"twitter"`
// Online indicates if the user is currently connected to the qri network
// Should not serialize to config.yaml
Online bool `json:"online,omitempty"`
// PeerIDs maps this profile to peer Identifiers in the form /[network]/peerID example:
// /ipfs/QmSyDX5LYTiwQi861F5NAwdHrrnd1iRGsoEvCyzQMUyZ4W
// where QmSy... is a peer identifier on the IPFS peer-to-peer network
// Should not serialize to config.yaml
PeerIDs []string `json:"peerIDs,omitempty"`
// NetworkAddrs keeps a list of locations for this profile on the network as multiaddr strings
// Should not serialize to config.yaml
NetworkAddrs []string `json:"networkAddrs,omitempty"`
}
ProfilePod is serializable plain-old-data that configures a qri profile
func DefaultProfile ¶
func DefaultProfile() *ProfilePod
DefaultProfile gives a new default profile configuration
func DefaultProfileForTesting ¶ added in v0.5.2
func DefaultProfileForTesting() *ProfilePod
DefaultProfileForTesting constructs a profile with precomputed keys, only used for testing.
func (*ProfilePod) Copy ¶ added in v0.3.2
func (p *ProfilePod) Copy() *ProfilePod
Copy makes a deep copy of the ProfilePod struct
func (*ProfilePod) SetArbitrary ¶ added in v0.9.9
func (p *ProfilePod) SetArbitrary(key string, val interface{}) error
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
func (*ProfilePod) SetField ¶ added in v0.5.2
func (p *ProfilePod) SetField(field, value string) error
SetField assigns to the name field of the Profile. TODO: Replace this with a generic package.
func (ProfilePod) Validate ¶ added in v0.3.2
func (p ProfilePod) Validate() error
Validate validates all fields of profile returning all errors found.
type RPC ¶
RPC configures a Remote Procedure Call (RPC) listener
func (*RPC) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type Registry ¶ added in v0.3.1
type Registry struct {
Location string `json:"location"`
}
Registry encapsulates configuration options for centralized qri registries
func DefaultRegistry ¶ added in v0.3.1
func DefaultRegistry() *Registry
DefaultRegistry generates a new default registry instance
func (*Registry) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type Remote ¶ added in v0.9.0
type Remote struct {
// remote mode
Enabled bool `json:"enabled"`
// maximum size of dataset to accept for remote mode
AcceptSizeMax int64 `json:"acceptsizemax"`
// timeout for remote sessions, in milliseconds
AcceptTimeoutMs time.Duration `json:"accepttimeoutms"`
// require clients pushing blocks to send all blocks
RequireAllBlocks bool `json:"requireallblocks"`
// allow clients to request unpins for their own pushes
AllowRemoves bool `json:"allowremoves"`
}
Remote configures Qri for control over the network, accepting dataset push requests
func (*Remote) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type Remotes ¶ added in v0.7.3
Remotes encapsulates configuration options for remotes
func (*Remotes) SetArbitrary ¶ added in v0.7.3
SetArbitrary is for implementing the ArbitrarySetter interface defined by base/fill_struct.go
type Repo ¶
Repo configures a qri repo
func DefaultRepo ¶
func DefaultRepo() *Repo
DefaultRepo creates & returns a new default repo configuration
func (*Repo) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.
type Stats ¶ added in v0.9.2
type Stats struct {
Cache cache `json:"cache"`
}
Stats configures qri statistical metadata calculation
func DefaultStats ¶ added in v0.9.2
func DefaultStats() *Stats
DefaultStats creates & returns a new default stats configuration
func (*Stats) SetArbitrary ¶ added in v0.9.9
SetArbitrary is an interface implementation of base/fill/struct in order to safely consume config files that have definitions beyond those specified in the struct. This simply ignores all additional fields at read time.