config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxRows is absolute maximum for returning rows / results from database
	MaxRows = 500

	// MaxRulesToProcess is per-user absolute maximum number of rules to run for each document.
	MaxRulesToProcess = 50
)
View Source
const (
	SchemaVersion = 21
)

Variables

View Source
var Commit = ""
View Source
var Version = "dev"

Functions

func ConfigFromViper

func ConfigFromViper() error

ConfigFromViper initializes Config.C, reads all config values from viper and stores them to Config.C.

func DeinitLogging

func DeinitLogging()

func InitConfig

func InitConfig() error

InitConfig sets sane default values and creates necessary keys. This can be called only after initializing Config.C.

func InitLogging

func InitLogging() error

func MaxRecords

func MaxRecords(n int) int

MaxRevords returns minimum of MaxRows and n, where n might be supplied from user input. If n == 0, return MaxRows.

func RandomString

func RandomString(size int) (string, error)

RandomString creates new random string of given length in characters (not cryptographic). Modified from https://socketloop.com/tutorials/golang-derive-cryptographic-key-from-passwords-with-argon2

func RandomStringCrypt

func RandomStringCrypt(size int) (string, error)

RandomStringCrypt creates new random string of given length in characters (cryptographic). Modified from https://socketloop.com/tutorials/golang-derive-cryptographic-key-from-passwords-with-argon2

func Uptime

func Uptime() time.Duration

func UptimeString

func UptimeString() string

Types

type Api

type Api struct {
	Host           string
	Port           int
	Key            string
	TokenExpireSec int
	TokenExpire    time.Duration

	PublicUrl string
	CorsHosts []string

	StaticContentPath     string
	AuthRatelimitDisabled bool
}

Api contains http server config

func (*Api) CorsHostList

func (a *Api) CorsHostList() string

type Config

type Config struct {
	Api         Api
	Database    Database
	Processing  Processing
	Meilisearch Meilisearch
	Mail        Mail
	Logging     Logging
	CronJobs    CronJobs
}

Config contains application config

var C *Config

Application config that is loaded upon starting program

type CronJobs

type CronJobs struct {
	Disabled                  bool
	DocumentsTrashbinDuration time.Duration
}

type Database

type Database struct {
	Host     string
	Port     int
	Username string
	Password string
	Database string
	NoSSL    bool
}

Database

type Logging

type Logging struct {
	Loglevel      string
	LogDirectory  string
	LogHttpStdout bool
	HttpLogFile   string
	LogFile       string
	LogStdout     bool

	HttpLog *logrus.Logger
	// contains filtered or unexported fields
}

Logging configuration

type Mail

type Mail struct {
	// Is mailing enabled
	Enabled bool

	// Smpt host
	Host string
	Port int

	Username string
	Password string

	From string
	// Recipient to send errors
	ErrorRecipient string
}

Mail contains configuration for sending mails.

type Meilisearch

type Meilisearch struct {
	Url    string
	Index  string
	ApiKey string
}

Meilisearch contains search-engine configuration

type Processing

type Processing struct {
	Disabled     bool
	TmpDir       string
	DataDir      string
	MaxWorkers   int
	OcrLanguages []string
	PdfToTextBin string
	PandocBin    string
	ImagickBin   string
	TesseractBin string

	// application directories. Stored by default in ./media/{previews, documents}.
	PreviewsDir  string
	DocumentsDir string
}

Processing contains document-processing settings

Jump to

Keyboard shortcuts

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