app

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package app provides the app's configuration. The first configuration file is app.json found adjacent to the executable.

Index

Constants

This section is empty.

Variables

View Source
var (
	BackupPath    string // BackupPath is the directory where the data is backed up.
	DBBasePath    string // DBBasePath is the directory where the database files are stored.
	ImagesDir     string // ImagesDir is the directory where user images are stored.
	LogsDir       string // LogsDir is the directory where the logs are stored.
	ThumbnailsDir string // ThumbnailsDir is the directory where the thumbnails of user images are stored.
	VideosDir     string // VideosDir is the directory where user videos are stored.

	ImageExt = ".webp" // ImageExt is the file extension for images.
	VideoExt = ".webm" // VideoExt is the file extension for videos.

	Info = GeneralInfo{
		Version: semver.Version{
			Major: 1,
			Minor: 3,
			Patch: 0,
		},
	} // Info stores general application information.

	FdcDB     = "fdc.db"     // FdcDB is the name of the FDC database.
	RecipyaDB = "recipya.db" // RecipyaDB is the name of Recipya's main database.

	ErrNoUpdate = errors.New("already latest version") // ErrNoUpdate is the error for when the application is up-to-date.
)

Functions

func Init

func Init()

Init initializes the app. This function must be called when the app starts. Its name is not *init* so that the function is not executed during the tests.

func NewConfig added in v1.1.0

func NewConfig(r io.Reader)

NewConfig initializes the global Config. It can either be populated from environment variables or the configuration file.

Types

type AzureDI added in v1.2.0

type AzureDI struct {
	Endpoint string `json:"endpoint"`
	Key      string `json:"key"`
}

AzureDI holds configuration data for the Azure AI Document Intelligence integration.

func (AzureDI) PrepareRequest added in v1.2.0

func (a AzureDI) PrepareRequest(file io.Reader) (*http.Request, error)

PrepareRequest prepares the HTTP request to analyze a document.

type ConfigEmail

type ConfigEmail struct {
	From           string `json:"from"`
	SendGridAPIKey string `json:"sendGridAPIKey"`
}

ConfigEmail holds email configuration variables.

type ConfigFile

type ConfigFile struct {
	Email        ConfigEmail        `json:"email"`
	Integrations ConfigIntegrations `json:"integrations"`
	Server       ConfigServer       `json:"server"`
}

ConfigFile holds the contents of config.json.

var Config ConfigFile

Config references a global ConfigFile.

func (*ConfigFile) Address

func (c *ConfigFile) Address() string

Address assembles the server's web address from its URL and host.

func (*ConfigFile) IsCookieSecure added in v1.0.1

func (c *ConfigFile) IsCookieSecure() bool

IsCookieSecure returns whether the cookie should secure.

func (*ConfigFile) Update added in v1.2.0

func (c *ConfigFile) Update(updated ConfigFile) error

Update updates the application's configuration.

type ConfigIntegrations

type ConfigIntegrations struct {
	AzureDI AzureDI `json:"azureDocumentIntelligence"`
}

ConfigIntegrations holds configuration data for 3rd-party services.

type ConfigServer

type ConfigServer struct {
	IsAutologin  bool   `json:"autologin"`
	IsDemo       bool   `json:"isDemo"`
	IsNoSignups  bool   `json:"noSignups"`
	IsProduction bool   `json:"isProduction"`
	Port         int    `json:"port"`
	URL          string `json:"url"`
}

ConfigServer holds configuration data for the server.

type GeneralInfo added in v1.1.0

type GeneralInfo struct {
	IsFFmpegInstalled   bool
	IsUpdateAvailable   bool
	LastCheckedUpdateAt time.Time
	LastUpdatedAt       time.Time
	Version             semver.Version
}

GeneralInfo holds information on the application.

Jump to

Keyboard shortcuts

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