config

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFilePath is config JSON file path that will be parsed.
	ConfigFilePath = "../../config"
	// ConfigFileName is config JSON file name that will be parsed.
	ConfigFileName = "config.json"
	// 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
)
View Source
const (
	HerokuPort   = "PORT"
	EnvPort      = "MAL_PORT"
	EnvLogger    = "MAL_LOGGER"
	EnvRedisAddr = "MAL_REDIS_ADDRESS"
	EnvRedisPass = "MAL_REDIS_PASSWORD"
	EnvRedisDB   = "MAL_REDIS_DB"
	EnvRedisTime = "MAL_REDIS_TIME"
	EnvDBAddr    = "MAL_DB_ADDRESS"
	EnvDBDB      = "MAL_DB_DB"
	EnvDBSchema  = "MAL_DB_SCHEMA"
	EnvDBUser    = "MAL_DB_USER"
	EnvDBPass    = "MAL_DB_PASSWORD"
	EnvDBDebug   = "MAL_DB_DEBUG"
	EnvImage     = "MAL_CLEAN_IMAGE"
	EnvVideo     = "MAL_CLEAN_VIDEO"
	EnvVerbose   = "MAL_VERBOSE"
)

List of env variables.

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 `config.json` to malkeeper config.

func ConvertToMalConfig added in v0.3.0

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

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

Types

type Config added in v0.3.0

type Config struct {
	// go-malscraper REST API configuration.
	App struct {
		// HTTP port.
		Port string `json:"port"`
		// Log HTTP request and response.
		Logger bool `json:"logger"`
	} `json:"app"`

	// Redis configuration similar with go-redis options.
	Redis *configRedis `json:"redis"`

	// Database configuration for Postgresql.
	Database *configDB `json:"database"`

	// Clean URL from MyAnimeList.
	UrlCleaner struct {
		Image bool `json:"image"`
		Video bool `json:"video"`
	} `json:"urlCleaner"`

	// Verbose written in console/terminal.
	Verbose int `json:"verbose"`
}

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

func GetConfig

func GetConfig() (cfg Config, err error)

GetConfig to read and parse config from `config.json`. Will use config with this priority:

  1. ENV
  2. config.json

Jump to

Keyboard shortcuts

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