Documentation ¶
Overview ¶
Package serverinit 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 ¶
var ErrCamliPath = errors.New("invalid Camlistore request path")
Functions ¶
func WriteDefaultConfigFile ¶
WriteDefaultConfigFile generates a new default high-level server configuration file at filePath. If useSQLite, the default indexer will use SQLite, otherwise leveldb. If filePath already exists, it is overwritten.
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 DefaultEnvConfig ¶
DefaultEnvConfig returns the default configuration when running on a known environment. Currently this just includes Google Compute Engine. If the environment isn't known (nil, nil) is returned.
func Load ¶
Load returns a low-level "handler config" from the provided config. If the config 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 LoadFile ¶
LoadFile 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) AppURL ¶
AppURL returns a map of app name to app base URL for all the configured server apps.
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.
func (*Config) StartApps ¶
StartApps starts all the server applications that were configured during InstallHandlers. It should only be called after camlistored has started serving, since these apps might request some configuration from Camlistore to finish initializing.
func (*Config) UploadPublicKey ¶
UploadPublicKey uploads the public key blob with the sign handler that was configured during InstallHandlers.
type HandlerInstaller ¶
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.