app

package
v0.0.0-...-9a0b025 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentVersion string
	CurrentBranch  string
)
View Source
var (
	// ErrBadContentType is returned when the server gets an unexpected
	// content type.
	ErrBadContentType = errors.New("wrong content type")
)

Functions

func InitTemplates

func InitTemplates(path string)

InitTemplates parses the templates and panics if it can't

func RemoveFile

func RemoveFile(f string) error

RemoveFile removes a file from the filesystem.

func RenderTemplate

func RenderTemplate(w http.ResponseWriter, template string, data interface{})

RenderTemplate writes a template to a Response Panics if the templates haven't been initialized.

func ThrowInternalServerError

func ThrowInternalServerError(w http.ResponseWriter)

func UploadSavePhoto

func UploadSavePhoto(f io.Reader, name string, uploadConfig UploadConfig) (string, string, error)

UploadSavePhoto saves an uploaded file to the filesystem.

Types

type Config

type Config struct {
	Port string
}

A Config holds app-specific configuration.

type Configuration

type Configuration struct {
	App       Config
	DB        DatabaseConfig `yaml:"database"`
	Templates TemplateConfig
	Uploads   UploadConfig
}

A Configuration is the main config object.

type DatabaseConfig

type DatabaseConfig struct {
	Username, Password, Hostname, Name string
	Port                               int
}

A DatabaseConfig holds database-specific configuration.

type ErrorInfo

type ErrorInfo struct {
	Info, RedirectLink string
	RedirectTimer      int
}

ErrorInfo is used to fill the error with redirect page

type PageInfo

type PageInfo struct {
	// Username is populated if the user is logged in
	Username *string

	// Error is populated if an error message should be shown
	Error []string
}

PageInfo holds pieces of information that slot into standard placeholders on pages. Any field nay be null if applicable

type TemplateConfig

type TemplateConfig struct {
	Path string
}

A TemplateConfig holds template-specific configuration.

type UploadConfig

type UploadConfig struct {
	Path           string
	ThumbnailsPath string
}

An UploadConfig holds upload-specific configuration.

Jump to

Keyboard shortcuts

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