serverconfig

package
v0.0.0-...-d7e0ad7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2014 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package serverconfig is responsible for mapping from a Camlistore configuration file and instantiating HTTP Handlers for all the necessary endpoints.

Index

Constants

This section is empty.

Variables

View Source
var ErrCamliPath = errors.New("Invalid Camlistore request path")

Functions

This section is empty.

Types

type Config

type Config struct {
	jsonconfig.Obj
	UIPath string // Not valid until after InstallHandlers
	// contains filtered or unexported fields
}

A Config is the wrapper around a Camlistore JSON configuration file. Files on disk can be in either high-level or low-level format, but the Load function always returns the Config in its low-level format.

func Load

func Load(filename string) (*Config, error)

Load returns a low-level "handler config" from the provided filename. If the config file doesn't contain a top-level JSON key of "handlerConfig" with boolean value true, the configuration is assumed to be a high-level "user config" file, and transformed into a low-level config.

func (*Config) InstallHandlers

func (config *Config) InstallHandlers(hi HandlerInstaller, baseURL string, reindex bool, context *http.Request) (shutdown io.Closer, err error)

InstallHandlers creates and registers all the HTTP Handlers needed by config into the provided HandlerInstaller.

baseURL is required and specifies the root of this webserver, without trailing slash. context may be nil (used and required by App Engine only)

The returned shutdown value can be used to cleanly shut down the handlers.

type HandlerInstaller

type HandlerInstaller interface {
	Handle(path string, h http.Handler)
}

A HandlerInstaller is anything that can register an HTTP Handler at a prefix path. Both *http.ServeMux and camlistore.org/pkg/webserver.Server implement HandlerInstaller.

Jump to

Keyboard shortcuts

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