Documentation ¶
Overview ¶
Package server provides a simple frontend in form of an App Engine app built atop the weasel.Storage. See README.md for the design details.
This package is a work in progress and makes no API stability promises.
An example usage for App Engine Standard:
# app.yaml runtime: go api_version: go1 handlers: - url: /.* script: _go_app # app.go package app import ( "github.com/google/weasel" "github.com/google/weasel/server" ) func init() { conf := &server.Config{ Storage: weasel.DefaultStorage, Buckets: map[string]string{ "default": "my-gcs-bucket", }, HookPath: "/-/flush-gcs-cache", } server.Init(nil, conf) }
The "/-/flush-gcs-cache" needs to be hooked up with "my-gcs-bucket" manually using Object Change Notifications. See the following page for more details: https://cloud.google.com/storage/docs/object-change-notification
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Storage provides server with the content access. Storage *weasel.Storage // Buckets defines a mapping between a request attribute // and GCS buckets the responses should be served from. // The map must contain at least "default" key. Buckets map[string]string // KeyPathFn is a function that returns the appropriate key // that maps to a bucket and file path for a HTTP request. // Default is a function that returns the `host` HTTP header as // a bucket key and the relative path. KeyPathFn KeyPathFn // WebRoot is the content serving root pattern. // If empty, default is used. // Default value is "/". WebRoot string // GCS object change notification hook pattern. // If empty, no hook handler will be setup during Init. HookPath string // Redirects is a map of URLs the app will permanently redirect to // when the request host and path match a key. // Map values must not end with "/" and cannot contain query string. Redirects map[string]string // TLSOnly forces TLS connection for the specified host names. TLSOnly []string }
Config is used to init the server. See Init for more details.
Click to show internal directories.
Click to hide internal directories.