app

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 17 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.

	Info = GeneralInfo{
		Version: semver.Version{
			Major: 1,
			Minor: 1,
			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 AzureComputerVision

type AzureComputerVision struct {
	ResourceKey    string `json:"resourceKey"`
	VisionEndpoint string `json:"visionEndpoint"`
}

AzureComputerVision holds configuration data for the Azure Computer Vision API.

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.

type ConfigIntegrations

type ConfigIntegrations struct {
	AzureComputerVision AzureComputerVision `json:"azureComputerVision"`
}

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 {
	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