config

package
v0.0.0-...-8f0a943 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// DefaultFormat is the default image format
	DefaultFormat = "png"

	// DefaultQuality is the default quality for processed images
	DefaultQuality = 95

	// DefaultUserAgent is the default user-agent header to fetch images from URL with.
	// n.b. application version later appended to this.
	DefaultUserAgent = "picfit"

	// DefaultMimetypeDetector method to use
	DefaultMimetypeDetector = "extension"

	// DefaultPort is the default port of the application server
	DefaultPort = 3001

	// DefaultShardWidth is the default shard width
	DefaultShardWidth = 0

	// DefaultShardDepth is the default shard depth
	DefaultShardDepth = 0

	// DefaultShardRestOnly is the default shard rest behaviour
	DefaultShardRestOnly = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedSize

type AllowedSize struct {
	Height int
	Width  int
}

AllowedSize is a struct used in the allowed_sizes option

type Config

type Config struct {
	AllowedHeaders []string `mapstructure:"allowed_headers"`
	AllowedMethods []string `mapstructure:"allowed_methods"`
	AllowedOrigins []string `mapstructure:"allowed_origins"`
	Debug          bool
	Engine         *engineconfig.Config
	KVStore        *store.Config
	Logger         logger.Config
	Options        *Options
	Port           int
	SecretKey      string `mapstructure:"secret_key"`
	Sentry         *Sentry
	Shard          *Shard
	Storage        *storage.Config
}

Config is a struct to load configuration flags

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default config instance

func Load

func Load(path string) (*Config, error)

Load creates a Config struct from a config file path

func LoadFromContent

func LoadFromContent(content string) (*Config, error)

LoadFromContent creates a Config struct from a config content

type Options

type Options struct {
	AllowedIPAddresses  []string      `mapstructure:"allowed_ip_addresses"`
	AllowedSizes        []AllowedSize `mapstructure:"allowed_sizes"`
	DefaultUserAgent    string        `mapstructure:"default_user_agent"`
	EnableCascadeDelete bool          `mapstructure:"enable_cascade_delete"`
	EnableDelete        bool          `mapstructure:"enable_delete"`
	EnableHealth        bool          `mapstructure:"enable_health"`
	EnablePprof         bool          `mapstructure:"enable_pprof"`
	EnableStats         bool          `mapstructure:"enable_stats"`
	EnableUpload        bool          `mapstructure:"enable_upload"`
	EnablePrometheus    bool          `mapstructure:"enable_prometheus"`
	MimetypeDetector    string        `mapstructure:"mimetype_detector"`
	FreeMemoryInterval  int           `mapstructure:"free_memory_interval"`
	TransformTimeout    int           `mapstructure:"transform_timeout"`
}

Options is a struct to add options to the application

type Sentry

type Sentry struct {
	DSN  string
	Tags map[string]string
}

Sentry is a struct to configure sentry using a dsn

type Shard

type Shard struct {
	Depth    int
	RestOnly bool
	Width    int
}

Shard is a struct to allow shard location when files are uploaded

Jump to

Keyboard shortcuts

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