Documentation
¶
Overview ¶
Package server implements the config server
The server consists of an API handler and a store.
Package server implements the config server ¶
The server consists of an API handler and a store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuth ¶
func BasicAuth(s Store, authorized, unauthorized func(r *http.Request) Store) func(r *http.Request) Store
BasicAuth is the basic auth middleware that checks if a request is authorized by looking up the store for the key `auth:basic:user`. If allowed, it uses the authoried store, else the unauthorized store
func Handler ¶
Handler returns a HTTP handler for the config server service
The store factory passed in is used to create a store for each request.
func SetBasicAuthInfo ¶
SetBasicAuthInfo sets the basic auth password for the provided user
Types ¶
type Store ¶
type Store interface { // GetSince returns all config changed since the last version // // Versions start from 1. Passing in a smaller version than // that would automatically fetch all config entries GetSince(version int) (newVersion int, configs map[string]string) // Set updates the connfig entry for the specific key Set(key string, val string) // History fetches changes for a specific key in reverse // chronological order. The epoch can be used for // continuation with an empty string being the initial value History(key, epoch string) (newEpoch string, configs []string) }
Store is the storage interface for the server. See NewReids/Store for an emplementation
func NewRedisStore ¶
NewRedisStore creates a new redis-based store
The address is the redis server address in host:port format. The provided namespace is used to construct a prefix of the form "{fig_<ns>}" for all the keys