system

package
v0.0.0-...-e4e8516 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2016 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RouteProtected means the user has to have logged in in order to access this route
	RouteProtected = 1
	// RoutePublic means this route is publicly accessible (no need for a log in)
	RoutePublic = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Configuration *Configuration
	Template      *template.Template
	Store         *sessions.CookieStore
	DBSession     *gorp.DbMap
}

Application holds our app's global variables

func (*Application) ApplyAuth

func (application *Application) ApplyAuth(c *web.C, h http.Handler) http.Handler

ApplyAuth makes sure controllers can check if the user is authorized

func (*Application) ApplyDatabase

func (application *Application) ApplyDatabase(c *web.C, h http.Handler) http.Handler

ApplyDatabase makes sure controllers can have access to the database

func (*Application) ApplyProtectionFromCSRF

func (application *Application) ApplyProtectionFromCSRF(c *web.C, h http.Handler) http.Handler

ApplyProtectionFromCSRF makes all POST messages check for a csrf_token

func (*Application) ApplySessions

func (application *Application) ApplySessions(c *web.C, h http.Handler) http.Handler

ApplySessions makes sure controllers can have access to session

func (*Application) ApplyTemplates

func (application *Application) ApplyTemplates(c *web.C, h http.Handler) http.Handler

ApplyTemplates makes sure templates are stored in the context

func (*Application) Close

func (application *Application) Close()

Close cleans up anything nicely before exiting the process

func (*Application) ConnectToDatabase

func (application *Application) ConnectToDatabase()

ConnectToDatabase initializes our database connection

func (*Application) Init

func (application *Application) Init(filename *string)

Init initializes our globals

func (*Application) LoadTemplates

func (application *Application) LoadTemplates() error

LoadTemplates initializes the template engine

func (*Application) Route

func (application *Application) Route(controller interface{}, route string, protected int) interface{}

Route defines a web route

type Configuration

type Configuration struct {
	Environment   string                `json:"environment"`
	ListeningPort string                `json:"listening_port"`
	Secret        string                `json:"secret"`        // Secret value for crypto of cookies.  Change this periodically.
	PublicPath    string                `json:"public_path"`   // Public web files
	TemplatePath  string                `json:"template_path"` // Template directory (the views)
	BaseURL       string                `json:"base_url"`      // In production this is "https://app.summitroute.com"
	Database      ConfigurationDatabase `json:"database"`
	Aws           ConfigurationAWS      `json:"aws"`
}

Configuration is the main structure of our config.json file

func (*Configuration) Load

func (configuration *Configuration) Load(filename string) (err error)

Load parses our configuration file

func (*Configuration) Parse

func (configuration *Configuration) Parse(data []byte) (err error)

Parse parses the configuration file into a structure

type ConfigurationAWS

type ConfigurationAWS struct {
	Ses utils.AwsSes `json:"ses"`
}

ConfigurationAWS is a sub-element of Configuration

type ConfigurationDatabase

type ConfigurationDatabase struct {
	ConnectionString string `json:"connection_string"`
}

ConfigurationDatabase is a sub-element of Configuration

type Controller

type Controller struct {
}

Controller blah

func (*Controller) GetDatabase

func (controller *Controller) GetDatabase(c web.C) *gorp.DbMap

GetDatabase blah

func (*Controller) GetSession

func (controller *Controller) GetSession(c web.C) *sessions.Session

GetSession blah

func (*Controller) GetTemplate

func (controller *Controller) GetTemplate(c web.C) *template.Template

GetTemplate blah

func (*Controller) Parse

func (controller *Controller) Parse(t *template.Template, name string, data interface{}) string

Parse blah

Jump to

Keyboard shortcuts

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