config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the default value the port has
	DefaultPort = 3805

	// DefaultReplica is the default number of replicas use
	// if none is defined
	DefaultReplica = 3

	// DefaultCacheSize is the default size of the cache
	DefaultCacheSize = 200

	// DefaultVolumeDowntime is the default time
	// a Volume can be down before start replicating
	DefaultVolumeDowntime = 2 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.2.0

type Cache struct {
	Size int `mapstructure:"size"`
}

Cache is the configuration required for the cache

type Config

type Config struct {
	// Port is the port to open to the public
	Port int `mapstructure:"port"`

	// Volumes is the list of the local volumes
	Volumes []string `mapstructure:"volumes"`

	// Remote is the URL of another Node
	Remote string `mapstructure:"remote"`

	// Replica is the default number of replicas
	// that each file will have if none specified
	// If set to -1 it'll not try to replicate any
	// of the created files and it'll not store any
	// replica from another Node
	Replica int `mapstructure:"replica"`

	// VolumeDowntime is the maximum time a volume can be down
	// before the rest of the cluster try to rebalance
	// the lost of data, is the time we'll wait for it
	// to go back up again
	VolumeDowntime time.Duration `mapstructure:"volume-downtime"`

	// Name is the name the Node will have inside of the Memberlist
	Name string `mapstructure:"name"`

	Cache Cache

	Memberlist Memberlist

	Dashboard Dashboard
}

Config represents the struct with all the possible configuration options

func New

func New(v *viper.Viper) (*Config, error)

New returns a new Config from the viper.Viper, the ENV variables are reade by using the convertion of "_" and all caps

type Dashboard added in v0.2.0

type Dashboard struct {
	Port    int  `mapstructure:"port"`
	Enabled bool `mapstructure:"enabled"`
}

Dashboard is the configuration required for the dashboard

type Memberlist added in v0.2.0

type Memberlist struct {
	Port int `mapstructure:"port"`
}

Memberlist is the set of configuration required for the memberlist, the name has moved to the main part of the config as it's more clear there

Jump to

Keyboard shortcuts

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