config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	ShutdownTimeout time.Duration    `mapstructure:"shutdown-timeout"`
	Logging         *LoggingConfig   `mapstructure:"logging"`
	Server          *ServerConfig    `mapstructure:"server"`
	Router          *RouterConfig    `mapstructure:"router"`
	Store           *StoreConfig     `mapstructure:"store"`
	Tokenizer       *TokenizerConfig `mapstructure:"tokenizer"`
}

type BoltStoreConfig

type BoltStoreConfig struct {
	FilePath string        `mapstructure:"path"`
	Timeout  time.Duration `mapstructure:"timeout"`
}

type HashidTokenizerConfig

type HashidTokenizerConfig struct {
	Salt      string `mapstructure:"salt"`
	MinLength int    `mapstructure:"min-length"`
	Alphabet  string `mapstructure:"alphabet"`
}

type LoggingConfig

type LoggingConfig struct {
	// Path to log output file; empty = os.Stdout
	FilePath string `mapstructure:"path"`
	// logging levels: panic, fatal, error, warn / warning, info, debug, trace
	Level string `mapstructure:"level"`
	// supported logging formats: text, json
	Format string `mapstructure:"format"`
}

logging:

path: "./log/shurl.log"
level: debug
format: text

type MemStoreConfig added in v0.0.2

type MemStoreConfig struct {
	FilePath string `mapstructure:"path"`
}

type RouterConfig

type RouterConfig struct {
	WebPath string `mapstructure:"web-path"`
}

router:

web-path: "web"

type ServerConfig

type ServerConfig struct {
	// Address string        `mapstructure:"addr"`
	Host    string        `mapstructure:"host"`
	Port    int           `mapstructure:"port"`
	Timeout time.Duration `mapstructure:"timeout"`
}

server:

addr: "0.0.0.0:8443"
timeout: 3s

type StoreConfig

type StoreConfig struct {
	Bolt *BoltStoreConfig `mapstructure:"bolt"`
	Mem  *MemStoreConfig  `mapstructure:"mem"`
}

store:

bolt:
  path: "links.db"
  timeout: 1s

type TokenizerConfig

type TokenizerConfig struct {
	Hashid *HashidTokenizerConfig `mapstructure:"hashid"`
}

tokenizer:

hashid:
  salt: "ecafbaf0-1bcc-11ec-9621-0242ac130002"
  min-length: 5
  alphabet: "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Jump to

Keyboard shortcuts

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