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 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) 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 Render
- type Repo
- type Store
- type Update
- type Webapp
Constants ¶
const CurrentConfigRevision = 1
CurrentConfigRevision is the latest configuration revision configurations that don't match this revision number should be migrated up
Variables ¶
var DefaultAPIPort = 2503
DefaultAPIPort is local the port webapp serves on by default
var DefaultRPCPort = 2504
DefaultRPCPort is local the port RPC serves on by default
var DefaultUpdateAddress = "127.0.0.1:2506"
DefaultUpdateAddress is the local address Update serves on by default
var DefaultWebappPort = 2505
DefaultWebappPort is local the port webapp serves on by default
Functions ¶
func ImmutablePaths ¶
ImmutablePaths returns a map of paths that should never be modified
Types ¶
type API ¶
type API struct { Enabled bool `json:"enabled"` // APIPort specifies the port to listen for JSON API calls Port int `json:"port"` // read-only mode ReadOnly bool `json:"readonly"` // remote mode // // Deprecated: use config.Remote instead RemoteMode bool `json:"remotemode"` // maximum size of dataset to accept for remote mode // // Deprecated: use config.Remote instead RemoteAcceptSizeMax int64 `json:"remoteacceptsizemax"` // timeout for remote sessions, in milliseconds // // Deprecated: use config.Remote instead RemoteAcceptTimeoutMs time.Duration `json:"remoteaccepttimeoutms"` // URLRoot is the base url for this server URLRoot string `json:"urlroot"` // TLS enables https via letsEyncrypt TLS bool `json:"tls"` // Time in seconds to stop the server after, // default 0 means keep alive indefinitely DisconnectAfter int `json:"disconnectafter,omitempty"` // if true, requests that have X-Forwarded-Proto: http will be redirected // to their https variant ProxyForceHTTPS bool `json:"proxyforcehttps"` // 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"` }
API holds configuration for the qri JSON api
type CLI ¶
type CLI struct {
ColorizeOutput bool `json:"colorizeoutput"`
}
CLI defines configuration details for the qri command line client (CLI)
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 Store *Store P2P *P2P Update *Update Registry *Registry Remotes *Remotes Remote *Remote CLI *CLI API *API Webapp *Webapp RPC *RPC Logging *Logging Render *Render // 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) 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
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"` PubKey string `json:"pubkey"` 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"` // HTTPGatewayAddr is an address that qri can use to resolve p2p assets // over HTTP, represented as a url. eg: https://ipfs.io HTTPGatewayAddr string `json:"httpgatewayaddr"` // ProfileReplication determines what to do when this peer sees messages // broadcast by it's own profile (from another peer instance). setting // ProfileReplication == "full" will cause this peer to automatically pin // any data that is verifiably posted by the same peer ProfileReplication string `json:"profilereplication"` // 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
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) 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
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
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
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 Render ¶ added in v0.3.2
type Render struct { // TemplateUpdateAddress is currently an IPNS location to check for updates. api.Server starts // this address is checked, and if the hash there differs from DefaultTemplateHash, it'll use that instead TemplateUpdateAddress string `json:"templateUpdateAddress"` // DefaultTemplateHash is a hash of the compiled template // this is fetched and replaced via dnslink when the render server starts // the value provided here is just a sensible fallback for when dnslink lookup fails, // pointing to a known prior version of the the render DefaultTemplateHash string `json:"defaultTemplateHash"` }
Render configures the qri render command
func DefaultRender ¶ added in v0.3.2
func DefaultRender() *Render
DefaultRender creates a new default Render configuration
type Repo ¶
type Repo struct { Middleware []string `json:"middleware"` Type string `json:"type"` Path string `json:"path,omitempty"` }
Repo configures a qri repo
func DefaultRepo ¶
func DefaultRepo() *Repo
DefaultRepo creates & returns a new default repo configuration
type Store ¶
type Store struct { Type string `json:"type"` Options map[string]interface{} `json:"options,omitempty"` Path string `json:"path,omitempty"` }
Store configures a qri content addessed file store (cafs)
func DefaultStore ¶
func DefaultStore() *Store
DefaultStore returns a new default Store configuration
type Update ¶ added in v0.8.0
type Update struct { Type string `json:"type"` Daemonize bool `json:"daemonize"` Address string `json:"address"` }
Update configures a Remote Procedure Call (Update) listener
func DefaultUpdate ¶ added in v0.8.0
func DefaultUpdate() *Update
DefaultUpdate creates a new default Update configuration
type Webapp ¶
type Webapp struct { Enabled bool `json:"enabled"` Port int `json:"port"` // token for analytics tracking AnalyticsToken string `json:"analyticstoken"` // EntrypointUpdateAddress is currently an IPNS location to check for updates. api.Server starts // this address is checked, and if the hash there differs from EntrypointHash, it'll use that instead EntrypointUpdateAddress string `json:"entrypointupdateaddress"` // EntrypointHash is a hash of the compiled webapp (the output of running webpack https://github.com/qri-io/frontend) // this is fetched and replaced via dnslink when the webapp server starts // the value provided here is just a sensible fallback for when dnslink lookup fails, // pointing to a known prior version of the the webapp EntrypointHash string `json:"entrypointhash"` }
Webapp configures the qri webapp service
func DefaultWebapp ¶
func DefaultWebapp() *Webapp
DefaultWebapp creates a new default Webapp configuration