config

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config is resposible for finding, parsing and merging the HTTPMS user configuration with the default. Configuration locations should be different depending on the host OS.

Linux/BSD configurations should be in $HOME/.euterpe/config.json Windows configurations should be in %APPDATA%/euterpe/config.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserConfigPath added in v1.2.0

func UserConfigPath(appfs afero.Fs) string

UserConfigPath returns the full path to the place where the user's configuration file should be

Types

type Auth added in v1.0.2

type Auth struct {
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
	Secret   string `json:"secret"`
}

Auth represents a configuration HTTP Basic authentication

type Cert added in v1.0.2

type Cert struct {
	Crt string `json:"crt,omitempty"`
	Key string `json:"key,omitempty"`
}

Cert represents a configuration for TLS certificate

type Config

type Config struct {
	Listen           string      `json:"listen,omitempty"`
	SSL              bool        `json:"ssl,omitempty"`
	SSLCertificate   Cert        `json:"ssl_certificate,omitempty"`
	Auth             bool        `json:"basic_authenticate,omitempty"`
	Authenticate     Auth        `json:"authentication,omitempty"`
	Libraries        []string    `json:"libraries,omitempty"`
	LibraryScan      ScanSection `json:"library_scan,omitempty"`
	LogFile          string      `json:"log_file,omitempty"`
	SqliteDatabase   string      `json:"sqlite_database,omitempty"`
	Gzip             bool        `json:"gzip,omitempty"`
	ReadTimeout      int         `json:"read_timeout,omitempty"`
	WriteTimeout     int         `json:"write_timeout,omitempty"`
	MaxHeadersSize   int         `json:"max_header_bytes,omitempty"`
	DownloadArtwork  bool        `json:"download_artwork,omitempty"`
	DiscogsAuthToken string      `json:"discogs_auth_token,omitempty"`
}

Config contains representation for everything in config.json

func FindAndParse added in v1.2.0

func FindAndParse(appfs afero.Fs) (Config, error)

FindAndParse actually finds the configuration file, parsing it and merging it on top the default configuration.

type ScanSection added in v1.0.2

type ScanSection struct {
	Disable           bool          `json:"disable,omitempty"`
	FilesPerOperation int64         `json:"files_per_operation,omitempty"`
	SleepPerOperation time.Duration `json:"sleep_after_operation,omitempty"`
	InitialWait       time.Duration `json:"initial_wait_duration,omitempty"`
}

ScanSection is used for merging the two configs. Its purpose is to essentially hold the default values for its properties.

func (*ScanSection) UnmarshalJSON added in v1.0.2

func (ss *ScanSection) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a JSON and populets its ScanSection. Satisfies the Unmrashaller interface.

Jump to

Keyboard shortcuts

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