config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Port fs db server port.
	//   Default: 8888
	//   Env: PORT
	Port int `yaml:"port"`

	// Storage fs db storage options.
	Storage Storage `yaml:"storage"`
}

Config provides fs db configuration options.

Default:
  port: 8888
  storage:
    dbPath: test.db
    maxDirCount: 1000000
    rootDirs:
      - ./testStorage

func ParseConfig

func ParseConfig(confFile string) (*Config, error)

ParseConfig returns filled Config options from a configuration file.

func (*Config) ParseEnv

func (c *Config) ParseEnv() error

ParseEnv fills the config options with environment variables.

type Storage

type Storage struct {
	// DbPath path to the SQLite database file.
	// 	 Default: test.db
	// 	 Env: DB_PATH
	DbPath string `yaml:"dbPath"`

	// MaxDirCount max number of files in one subdirectory.
	//   Default: 1_000_000
	//   Env: DIR_COUNT
	MaxDirCount uint64 `yaml:"maxDirCount"`

	// RootDirs slice with root directories.
	//   Default: ["./testStorage"]
	//   Env: ROOT_DIRS
	RootDirs []string `yaml:"rootDirs"`
}

Storage provides configuration options for fs db storage.

Default:
  dbPath: test.db
  maxDirCount: 1000000
  rootDirs:
    - ./testStorage

func (*Storage) ParseEnv

func (s *Storage) ParseEnv() error

ParseEnv fills the storage options with environment variables.

func (*Storage) Valid

func (s *Storage) Valid() error

Valid validates the storage options.

Jump to

Keyboard shortcuts

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