config

package
v0.0.0-...-5728737 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSizeLimit is an error, when storage limit is reached.
	ErrSizeLimit = errors.New("size limit is reached")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Server   server   `toml:"server"`
	Storage  Storage  `toml:"Storage"`
	Settings Settings `toml:"settings"`
}

Config is a main configuration structure.

func (*Config) Addr

func (c *Config) Addr() string

Addr returns service's net address.

func (*Config) Close

func (c *Config) Close() error

Close frees resources.

func (*Config) GCPeriod

func (c *Config) GCPeriod() time.Duration

GCPeriod is gc period in seconds.

func (*Config) MaxFileSize

func (c *Config) MaxFileSize() int

MaxFileSize returns max file size.

func (*Config) Secret

func (c *Config) Secret(p string) string

Secret returns string with salt.

func (*Config) Timeout

func (c *Config) Timeout() time.Duration

Timeout is service timeout.

type Settings

type Settings struct {
	TTL      int    `toml:"ttl"`
	Times    int    `toml:"times"`
	Size     int    `toml:"size"`
	Salt     string `toml:"salt"`
	GC       int    `toml:"gc"`
	PassLen  int    `toml:"passlen"`
	Shutdown int    `toml:"shutdown"`
}

Settings struct is base service settings.

type Storage

type Storage struct {
	sync.Mutex
	File string `toml:"file"`
	Dir  string `toml:"dir"`
	Size int64  `toml:"size"`

	Db *sql.DB
	// contains filtered or unexported fields
}

Storage is storage configuration params struct.

func (*Storage) Limit

func (s *Storage) Limit(v int64) error

Limit updates storage limit and returns and error if it's reached.

func (*Storage) String

func (s *Storage) String() string

String returns base info about Storage.

Jump to

Keyboard shortcuts

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