app

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MAXPORTS is the maximum number of ports allowable for a single host without ForcePorts enabled.
	MAXPORTS = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	R          *render.Render
	C          C
	S          *mgo.Session
	Version    string
	History    int
	Filepath   string
	DName      string
	Transforms []Transform
}

App is used to map global variables used in handlers.

func New

func New(o *O) *App

New returns App with defaults.

func (*App) Auth

func (a *App) Auth() negroni.HandlerFunc

Auth is a middleware to authenicate a user to Lair's meteor resources and ensures it has access the project provided in the url parameter.

func (*App) AuthProject

func (a *App) AuthProject() negroni.HandlerFunc

AuthProject is a middleware to authorize a user to a project.

func (*App) IndexHost

func (a *App) IndexHost(w http.ResponseWriter, req *http.Request)

IndexHost is an HTTP handler to retrieve a list hosts for a given project.

func (*App) IndexProject

func (a *App) IndexProject(w http.ResponseWriter, req *http.Request)

IndexProject is an HTTP handler to retrieve a list of all projects that a user owns or is a contributor for.

func (*App) IsValidStatus

func (a *App) IsValidStatus(status string) bool

IsValidStatus returns true if the provided string is a valid lair status.

func (*App) Mongo

func (a *App) Mongo() negroni.HandlerFunc

Mongo maps a copy of the session to the request context.

func (*App) RemoveFile

func (a *App) RemoveFile(w http.ResponseWriter, req *http.Request)

RemoveFile is an http handler for a DELETE request to remove a file.

func (*App) Router

func (a *App) Router() *mux.Router

Router returns a new mux router which can be used to start an app.

func (*App) ServeFile

func (a *App) ServeFile(w http.ResponseWriter, req *http.Request)

ServeFile is an http handler for a GET request to download a file.

func (*App) ShowProject

func (a *App) ShowProject(w http.ResponseWriter, req *http.Request)

ShowProject is an HTTP handler to retrieve a single project.

func (*App) UpdateProject

func (a *App) UpdateProject(w http.ResponseWriter, req *http.Request)

UpdateProject is an HTTP handler to add/update a project using additive, smart merge

func (*App) UploadFile

func (a *App) UploadFile(w http.ResponseWriter, req *http.Request)

UploadFile is a http handler for POST request to upload a file.

type C

type C struct {
	AuthInterfaces string
	Credentials    string
	Files          string
	Hosts          string
	Issues         string
	Netblocks      string
	People         string
	Projects       string
	Services       string
	Versions       string
	WebDirectories string
}

C is used to map collection names.

type O

type O struct {
	S                  *mgo.Session
	DName              string
	Filepath           string
	TransformDirectory string
}

O is options passed to New.

type Response

type Response struct {
	Status  string
	Message string
}

Response is used to return a status and message to handler requests.

type Transform added in v1.3.0

type Transform struct {
	Update func(*lair.Project)
}

Transform is a plugin that will transorm a lair.Project during update.

type User

type User struct {
	ID       string `bson:"_id"`
	Services struct {
		Password struct {
			Bcrypt string `bson:"bcrypt"`
		} `bson:"password"`
		Resume struct {
			Logintokens []struct {
				Hashedtoken string `bson:"hashedToken"`
			} `bson:"loginTokens"`
		} `bson:"resume"`
	} `bson:"services"`
	Emails []struct {
		Address string `bson:"address"`
	} `bson:"emails"`
}

User is a user from meteor.js.

Jump to

Keyboard shortcuts

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