middlewares

package
v0.0.0-...-700955b Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package middlewares is a group of functions. They mutualize some actions common to many gin handlers, like checking authentication or permissions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance() gin.HandlerFunc

SetInstance creates a gin middleware to put the instance in the gin context for next handlers

Types

type Instance

type Instance struct {
	Domain     string // The main DNS domain, like example.cozycloud.cc
	StorageURL string // Where the binaries are persisted
	// contains filtered or unexported fields
}

An Instance has the informations relatives to the logical cozy instance, like the domain, the locale or the access to the databases and files storage

func GetInstance

func GetInstance(c *gin.Context) *Instance

GetInstance will return the instance linked to the given gin context or panic if none exists

func (*Instance) GetDatabasePrefix

func (instance *Instance) GetDatabasePrefix() string

GetDatabasePrefix returns the prefix to use in database naming for the current instance

func (*Instance) GetStorageProvider

func (instance *Instance) GetStorageProvider() (afero.Fs, error)

GetStorageProvider returns the afero storage provider where the binaries for the current instance are persisted

Jump to

Keyboard shortcuts

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