app

package
v0.0.0-...-c8ec3b5 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package app helps with configuring and starting server applications from Camlistore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler acts as a reverse proxy for a server application started by Camlistore. It can also serve some extra JSON configuration to the app.

func NewHandler

func NewHandler(conf jsonconfig.Obj, apiHost, appHandlerPrefix string) (*Handler, error)

NewHandler returns a Handler that proxies requests to an app. Start() on the Handler starts the app. The apiHost must end in a slash and is the camlistored API server for the app process to hit. The appHandlerPrefix is the URL path prefix on apiHost where the app is mounted. It must end in a slash, and be at minimum "/". The conf object has the following members, related to the vars described in doc/app-environment.txt: "program", string, required. File name of the app's program executable. Either an absolute path, or the name of a file located in CAMLI_APP_BINDIR or in PATH. "backendURL", string, optional. Automatic if absent. It sets CAMLI_APP_BACKEND_URL. "appConfig", object, optional. Additional configuration that the app can request from Camlistore.

func (*Handler) AppConfig

func (a *Handler) AppConfig() map[string]interface{}

AppConfig returns the optional configuration parameters object that the app can request from the app handler. It can be nil.

func (*Handler) AuthMode

func (a *Handler) AuthMode() auth.AuthMode

AuthMode returns the app handler's auth mode, which is also the auth that the app's client will be configured with. This mode should be registered with the server's auth modes, for the app to have access to the server's resources.

func (*Handler) BackendURL

func (a *Handler) BackendURL() string

BackendURL returns the appBackendURL that the app handler will proxy to.

func (*Handler) ProgramName

func (a *Handler) ProgramName() string

ProgramName returns the name of the app's binary. It may be a file name in CAMLI_APP_BINDIR or PATH, or an absolute path.

func (*Handler) Quit

func (a *Handler) Quit() error

Quit sends the app's process a SIGINT, and waits up to 5 seconds for it to exit, returning an error if it doesn't.

func (*Handler) ServeHTTP

func (a *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Handler) Start

func (a *Handler) Start() error

Jump to

Keyboard shortcuts

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