config

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvPath is config .env file path that will be parsed.
	EnvPath = "../../config/.env"
	// EnvPrefix is environment
	EnvPrefix = "MAL"
	// DefaultPort is default HTTP port for go-malscraper.
	DefaultPort = "8005"
	// DefaultLogger is default value of logger config.
	DefaultLogger = true
	// DefaultRedisTime is default redis caching time (1 day).
	DefaultRedisTime = 86400
	// DefaultImageURLCleaner is default MyAnimeList image URL cleaning.
	DefaultImageURLCleaner = false
	// DefaultVideoURLCleaner is default MyAnimeList video URL cleaning.
	DefaultVideoURLCleaner = false
	// DefaultVerbose is default verbose level. Showing Info, Error, and Fatal log.
	DefaultVerbose = mallogger.DefaultLevel
)

Variables

This section is empty.

Functions

func ConvertToKeeperConfig added in v0.8.0

func ConvertToKeeperConfig(cfg Config) (keepCfg keeper.Config)

ConvertToKeeperConfig to convert parsed config from `.env` to malkeeper config.

func ConvertToMalConfig added in v0.3.0

func ConvertToMalConfig(cfg Config) (malCfg config.Config)

ConvertToMalConfig to convert parsed config from `.env` to malscraper config.

Types

type Config added in v0.3.0

type Config struct {
	// HTTP port.
	Port string `envconfig:"PORT"`
	// Log HTTP request and response.
	Logger bool `envconfig:"LOGGER"`
	// Verbose written in console/terminal.
	Verbose int `envconfig:"VERBOSE"`
	// Redis configuration similar with go-redis options.
	Redis *configRedis `envconfig:"REDIS"`
	// Database configuration for Postgresql.
	Database *configDB `envconfig:"DB"`
	// Clean URL from MyAnimeList.
	UrlCleaner configCleaner `envconfig:"CLEAN"`
}

Config is configuration read from `.env` for whole go-malscraper project.

func GetConfig

func GetConfig() (cfg Config, err error)

GetConfig to read and parse config from `.env`.

Jump to

Keyboard shortcuts

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