settings

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptchaSettings

type CaptchaSettings struct {
	// StoreImages flag configures the output of created images. When it is set
	// to True, Captcha manager stores an image on a storage device and
	// responds only with the task ID. When set to False, Captcha manager does
	// not store an image on a storage device and responds with both image
	// binary data and task ID.
	StoreImages bool `json:"storeImages"`

	// ImagesFolder sets the storage folder for created images. This setting is
	// used together with the 'StoreImages' flag.
	ImagesFolder string `json:"imagesFolder"`

	// Dimensions of created images.
	ImageWidth  uint `json:"imageWidth"`
	ImageHeight uint `json:"imageHeight"`

	// Image's time to live, in seconds. Each image is deleted when this time
	// passes after its creation.
	ImageTtlSec uint `json:"imageTtlSec"`

	ClearImagesFolderAtStart bool `json:"clearImagesFolderAtStart"`

	// This setting allows to start an HTTP server for serving captcha saved
	// image files. This setting is used together with the 'StoreImages' flag.
	UseHttpServerForImages bool `json:"useHttpServerForImages"`

	// Parameters of the HTTP server serving saved image files.
	HttpServerHost string `json:"httpServerHost"`
	HttpServerPort uint16 `json:"httpServerPort"`
	HttpServerName string `json:"httpServerName"`

	// Cache.
	IsCachingEnabled bool `json:"isCachingEnabled"`
	CacheSizeLimit   int  `json:"cacheSizeLimit"`
	CacheVolumeLimit int  `json:"cacheVolumeLimit"`
	CacheRecordTtl   uint `json:"cacheRecordTtl"`
}

CaptchaSettings are parameters of the captcha.

func (CaptchaSettings) Check

func (s CaptchaSettings) Check() (err error)

type HttpSettings

type HttpSettings = cs.HttpSettings

HttpSettings are settings of an HTTP server for incoming requests.

type Settings

type Settings struct {
	// Path to the file with these settings.
	FilePath string `json:"-"`

	// Program versioning information.
	VersionInfo *ver.Versioneer `json:"-"`

	HttpSettings    `json:"http"`
	SystemSettings  `json:"system"`
	CaptchaSettings `json:"captcha"`
}

Settings is Server's settings.

func NewSettingsFromFile

func NewSettingsFromFile(filePath string, versionInfo *ver.Versioneer) (stn *Settings, err error)

func (*Settings) Check

func (stn *Settings) Check() (err error)

func (*Settings) UseConstructor

func (stn *Settings) UseConstructor(filePath string, versionInfo *ver.Versioneer) (cm.ISettings, error)

type SystemSettings

type SystemSettings struct {
	IsDebugMode bool `json:"isDebugMode"`
}

SystemSettings are system settings.

func (SystemSettings) Check

func (s SystemSettings) Check() (err error)

Jump to

Keyboard shortcuts

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