config

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvConfPath

func GetEnvConfPath() string

GetEnvConfPath returns toml file path from environment variable `$GO-BOOK_CONF`

Types

type Console

type Console struct {
	Enabled bool `toml:"enabled"`
}

Console is command line notification

type Logger

type Logger struct {
	Service      string `toml:"service" validate:"required"`
	Env          string `toml:"env" validate:"oneof=dev prod custom"`
	Level        string `toml:"level" validate:"required"`
	IsStackTrace bool   `toml:"is_stacktrace"`
}

Logger is zap logger property

type Notification

type Notification struct {
	Mode    notifier.Mode `toml:"mode" validate:"required"`
	Console *Console      `toml:"console" validate:"-"`
	Slack   *Slack        `toml:"slack" validate:"-"`
}

Notification is notification method

type Redis

type Redis struct {
	Encrypted bool   `toml:"encrypted"`
	URL       string `toml:"url"`
	Env       string `toml:"env"`
}

Redis is redis save

type Root

type Root struct {
	Interval     int           `toml:"interval"`
	Site         *Site         `toml:"site" validate:"required"`
	Logger       *Logger       `toml:"logger" validate:"required"`
	Save         *Save         `toml:"save"`
	Notification *Notification `toml:"notification"`
}

Root is root config

func NewConfig

func NewConfig(fileName string) (*Root, error)

NewConfig returns *Root config

type Save

type Save struct {
	Mode  save.Mode `toml:"mode" validate:"oneof=text redis dummy"`
	Text  *Text     `toml:"text" validate:"-"`
	Redis *Redis    `toml:"redis" validate:"-"`
}

Save is save method

type Site

type Site struct {
	Type site.SiteType `toml:"type" validate:"oneof=dmm"`
	URL  string        `toml:"url" validate:"required"`
}

Site is site information

type Slack

type Slack struct {
	Enabled   bool   `toml:"enabled"`
	Encrypted bool   `toml:"encrypted"`
	Key       string `toml:"key" validate:"required"`
}

Slack is slack notification

type Text

type Text struct {
	Path string `toml:"path" validate:"required"`
}

Text is text save

Jump to

Keyboard shortcuts

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