config

package
v0.0.0-...-da267cc Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	General = generalConfig{
		RunMode:   "",
		LogLevel:  "",
		LogColour: false,
	}
	Tracker = trackerConfig{
		Public:                        false,
		Listen:                        "0.0.0.0:34000",
		TLS:                           false,
		IPv6:                          false,
		IPv6Only:                      false,
		AutoRegister:                  false,
		ReaperInterval:                "90s",
		ReaperIntervalParsed:          90 * time.Second,
		AnnounceInterval:              "30s",
		AnnounceIntervalParsed:        30 * time.Second,
		AnnounceIntervalMinimum:       "10s",
		AnnounceIntervalMinimumParsed: 10 * time.Second,
		HNRThreshold:                  "1d",
		HNRThresholdParsed:            24 * time.Hour,
		BatchUpdateInterval:           "30s",
		BatchUpdateIntervalParsed:     30 * time.Second,
		AllowNonRoutable:              true,
		AllowClientIP:                 false,
		MaxPeers:                      50,
	}
	API = rpcConfig{
		Listen: "localhost:34001",
		TLS:    false,
		Key:    "",
	}
	Store = StoreConfig{
		Type:       "memory",
		Host:       "",
		Port:       0,
		User:       "",
		Password:   "",
		Database:   "",
		Properties: "",
	}
	GeoDB = geoDBConfig{
		Path:    "",
		APIKey:  "",
		Enabled: false,
	}
)

Functions

func Read

func Read(cfgFile string) error

Read reads in config file and ENV variables if set.

func Save

func Save() error

Types

type StoreConfig

type StoreConfig struct {
	// Type sets the backing store type to be used
	// memory|redis|postgres|mysql|http
	Type string `mapstructure:"type"`
	// StoreTorrentHost is the host to connect to
	// localhost
	Host string `mapstructure:"host"`
	// StoreTorrentPort is the port to connect to
	// 3306|6379|443
	Port int `mapstructure:"port"`
	// User user to connect with
	// mika
	User string `mapstructure:"user"`
	// Password password to connect with
	// mika
	Password string `mapstructure:"password"`
	// Database is the database / schema name to open on the backing store
	// Redis uses numeric values 0-16 by default
	// mika|0
	Database string `mapstructure:"database"`
	// Properties will append a string of query args to the DSN
	// Format: arg1=foo&arg2=bar
	Properties string `mapstructure:"properties"`
}

func (StoreConfig) DSN

func (c StoreConfig) DSN() string

DSN constructs a URI for database connection strings

protocol//[user]:[password]@tcp([host]:[port])[/database][?properties]

Jump to

Keyboard shortcuts

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