config

package
v0.0.0-...-c99d64b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version             string                   `yaml:"version"`
	Port                int                      `yaml:"port"`   // Port on which the server should run
	Domain              string                   `yaml:"domain"` // URL of the server domain (example: https://example.com or localhost:8080)
	Database            *Database                `yaml:"database"`
	Storage             *Storage                 `yaml:"storage"`
	AllowedContentTypes []mediateq.ContentType   `yaml:"allowed_content_types"`
	MaxFileSizeBytes    int64                    `yaml:"max_file_size_bytes"`
	DeleteAllowed       bool                     `yaml:"delete_allowed"`
	DefaultImageSize    ImageSize                `yaml:"default_image_size"`
	ThumbnailSizes      []mediateq.ThumbnailSize `yaml:"thumbnail_sizes"`
}

Config is the global configuration object of mediateq server

func Load

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

Load loads mediateq configuration from yaml file

func (*Config) IsContentTypeAllowed

func (c *Config) IsContentTypeAllowed(contentType mediateq.ContentType) bool

IsContentTypeAllowed function searches the allowed content Types slice for the given content type and returns true if it is found, or false if it is not.

func (*Config) ParseAndValidate

func (c *Config) ParseAndValidate() error

type Database

type Database struct {
	Type     mediateq.DBType `yaml:"type"`
	Host     string          `yaml:"host"`
	Port     int             `yaml:"port"`
	DBName   string          `yaml:"db_name"`
	Username string          `yaml:"username"`
	Password string          `yaml:"password"`
}

type ImageSize

type ImageSize struct {
	Width  int `yaml:"width"`
	Height int `yaml:"height"`
}

ImageSize represent a size of an image. To preserve aspect ratio of the original image only the width should set (height should be 0)

type Storage

type Storage struct {
	Type       mediateq.StorageType `yaml:"type"`        // The type of storage used by the to read and write files
	UploadPath string               `yaml:"upload_path"` // Path to the folder were files should be uploaded
}

Jump to

Keyboard shortcuts

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