config

package
v0.0.0-...-5adb3e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(path string) error

func Mock

func Mock(cfg *Config)

Types

type Config

type Config struct {
	// Log configuration.
	Log struct {
		// Log level, supported name:
		// "panic", "fatal", "error", "warn", "warning",
		// "info", "debug", "trace"
		Level string `yaml:"level"`
		// Comma separated list of IPFS subsystem names to apply log level.
		// "*" means set to all.
		// Empty means leave it to default.
		IpfsSubsystems string `yaml:"ipfs_subsystems"`
		// Log file path. Default to stdout if empty.
		FilePath string `yaml:"file_path"`
		// If enable ANSI color in log.
		Color bool `yaml:"color"`
	}

	// Auth configs API authentication.
	Auth struct {
		// Disable authentication for API requests.
		// This should only be enabled for testing purpose.
		NoAuth                  bool     `yaml:"no_auth"`
		RedirectOnFailure       bool     `yaml:"redirect_on_failure"`
		StarbasePublicKeyBase64 string   `yaml:"starbase_public_key_base64"`
		Whitelist               []string `yaml:"whitelist"`
	} `yaml:"auth"`

	// IPFSConfig provides a simple means to config Kubo node behavior.
	// For advanced IPFS config, either use Kubo CLI command or edit
	// ~/.ipfs/config directly.
	IPFSConfig struct {
		MaxConnections     int           `yaml:"max_connections"`
		MaxMemMBytes       int           `yaml:"max_mem_mbytes"`
		MaxFileDescriptors int           `yaml:"max_file_descriptors"`
		ConnMgrLowWater    int           `yaml:"conn_mgr_low_water"`
		ConnMgrHighWater   int           `yaml:"conn_mgr_high_water"`
		ConnMgrGracePeriod time.Duration `yaml:"conn_mgr_grace_period"`
		DisableRelayClient bool          `yaml:"disable_relay_client"`
		EnablePubSub       bool          `yaml:"enable_pubsub"`
		Peers              []string      `yaml:"peers"`
	} `yaml:"ipfs_config"`

	ListenAddresses []ListenAddress `yaml:"listen_addresses"`

	ExternalServices struct {
		Starbase  string `yaml:"starbase"`
		Spaceport string `yaml:"spaceport"`
	} `yaml:"extern_services"`

	Discovery struct {
		PublicHost string `yaml:"public_host"`
		PublicPort int    `yaml:"public_port"`
	} `yaml:"discovery"`

	// Read from env FALCON_SECRET_KEY if empty.
	SecretKeyBase64 string `yaml:"secret_key_base64"`

	// Derived fields
	SecretKey       libp2pcrypto.PrivKey
	PublicKeyBase64 string
	GW3Hostname     string
	HttpClient      httpClient
}

Config defines the config for falcon gateway.

func Get

func Get() *Config

func (*Config) EnableNodeRegistration

func (c *Config) EnableNodeRegistration() bool

func (*Config) RequireTLSCert

func (c *Config) RequireTLSCert() bool

type ListenAddress

type ListenAddress struct {
	Address string `yaml:"address"`
	UseTLS  bool   `yaml:"use_tls"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL