config

package
v0.0.0-...-12687f4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(cfg *Config)

SetConfig set currently active config

Types

type Config

type Config struct {
	CacheControlHeader string                   `yaml:"cacheControlHeader"`
	DebugLevel         string                   `yaml:"debugLevel"`
	Fetchers           []map[string]interface{} `yaml:"fetchers"`
	Paths              []PathConfig             `yaml:"paths"`
	FaceAPI            struct {
		DefaultProvider  string `yaml:"defaultProvider"`
		MicrosoftFaceAPI struct {
			Key string `yaml:"key"`
			URL string `yaml:"url"`
		} `yaml:"microsoftFaceAPI"`
		GoogleCloudVisionAPI struct {
			Key string `yaml:"key"`
		} `yaml:"googleCloudVisionAPI"`
		AWSRekognition struct {
			Region string `yaml:"region"`
		} `yaml:"awsRekognition"`
	} `yaml:"faceapi"`
	Cache struct {
		Active   bool   `yaml:"active"`
		Provider string `yaml:"provider"`
		InMemory struct {
			Size int `yaml:"size"`
		} `yaml:"inmemory"`
		Redis struct {
			Host string `yaml:"host"`
			Port int    `yaml:"port"`
			DB   int    `yaml:"db"`
		} `yaml:"redis"`
	} `yaml:"cache"`
}

Config provides a configuration struct for the server

func GetConfig

func GetConfig() *Config

GetConfig return the currently active global config

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

LoadConfig loads the config file

func (*Config) GetFetcherConfigKeyValue

func (cfg *Config) GetFetcherConfigKeyValue(fetcherType string, key string) interface{}

GetFetcherConfigKeyValue returns a configuration key value of a fetcher

func (*Config) GetPathConfigByPath

func (cfg *Config) GetPathConfigByPath(path string) *PathConfig

GetPathConfigByPath returns the path config by the specified path

type PathConfig

type PathConfig struct {
	Path         string `yaml:"path"`
	FetcherName  string `yaml:"fetcherName"`
	CacheControl string `yaml:"cacheControl"`
}

PathConfig represents configuration for a path serving images

Jump to

Keyboard shortcuts

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