config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSRF

type CSRF struct {
	DevelopmentMode   bool   `json:"development_mode"`
	AuthenticationKey string `json:"authentication_key"`
}

func (CSRF) Key

func (c CSRF) Key() ([]byte, bool, error)

Key returns the configured 32 byte CSRF key, and a bool indicating whether development mode is enabled. If the CSRF is not well formed, an error is returned.

type Configuration

type Configuration struct {
	WebServer WebServer       `json:"web_server"`
	CSRF      CSRF            `json:"csrf"`
	Database  PersistentStore `json:"database_storage"`
	Statsd    stats.Statsd    `json:"statsd"`
	Proxies   Proxies         `json:"proxies"`
}

func (Configuration) String

func (c Configuration) String() string

type DSN

type DSN struct {
	User                 string            `json:"user,omitempty"`
	Password             string            `json:"password,omitempty"`
	Address              string            `json:"address,omitempty"`
	Database             string            `json:"database,omitempty"`
	Parameters           map[string]string `json:"parameters,omitempty"`
	ServerPublicKey      string            `json:"server_public_key,omitempty"`
	AllowNativePasswords bool              `json:"allow_native_passwords,omitempty"`
}

DSN represents the "data source name" for a database.

func (DSN) String

func (dsn DSN) String() string

type PersistentStore

type PersistentStore struct {
	MySQL      DSN `json:"mysql,omitempty"`
	PostgreSQL DSN `json:"postgres,omitempty"`
}

func (PersistentStore) DSN

func (ps PersistentStore) DSN() (string, DSN, error)

DSN returns the one DSN that is configured, or returns an error if both or no DSN is configured.

type Proxies

type Proxies struct {
	PruneAfter int `json:"prune_after_s"`
}

type WebServer

type WebServer struct {
	TLS struct {
		Enabled     bool   `json:"enabled"`
		Certificate string `json:"certificate"`
		Key         string `json:"key"`
	} `json:"tls"`
	BindAddress   string   `json:"bind_address"`
	Port          int      `json:"port"`
	ReadTimeoutS  int      `json:"read_timeout_s"`
	WriteTimeoutS int      `json:"write_timeout_s"`
	APIKeys       []string `json:"api_keys"`
}

func (WebServer) Server

func (s WebServer) Server(mux http.Handler) (*http.Server, error)

Jump to

Keyboard shortcuts

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