Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigFromViper() error
- func DeinitLogging()
- func InitConfig() error
- func InitLogging() error
- func MaxRecords(n int) int
- func RandomString(size int) (string, error)
- func RandomStringCrypt(size int) (string, error)
- func Uptime() time.Duration
- func UptimeString() string
- type Api
- type Config
- type CronJobs
- type Database
- type Logging
- type Mail
- type Meilisearch
- type Processing
Constants ¶
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 )
const (
SchemaVersion = 21
)
Variables ¶
var Commit = ""
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 ¶
MaxRevords returns minimum of MaxRows and n, where n might be supplied from user input. If n == 0, return MaxRows.
func RandomString ¶
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 ¶
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 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 ¶
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 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 ¶
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