options

package
v0.0.0-...-c5b96c6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeLambda = "lambda"
	ModeHTTP   = "http"
)

Server mode constants

Variables

This section is empty.

Functions

func GenerateSecret

func GenerateSecret(len int) (string, error)

GenerateSecret Helper to generate a default secret to use

func Parse

func Parse(i interface{}) error

Parse parses command line options

Types

type Base

type Base struct {
	Mode            string `short:"m" long:"mode" description:"Server mode" choice:"http" choice:"lambda" default:"http"`
	BindAddress     string `short:"b" long:"address" description:"Address to bind API server" default:"0.0.0.0"`
	Port            string `short:"p" long:"port" description:"Port on which to bind API server" default:"10001"`
	ExternalAddress string `short:"e" long:"external-address" description:"External address for connection to server" default:"localhost:10001"`
	StaticDir       string `short:"s" long:"static-dir" description:"Directory to serve static content from (if specified)"`

	TLS `namespace:"tls" group:"Transport Layer Security (TLS) options"`

	CookieSecret string `long:"cookie-secret" description:"Secret for session cookie encryption (defaults to a random key)"`
	Session      `namespace:"cookie" group:"Session storage options"`

	LogEndpoints bool `long:"log-endpoints" description:"Enable endpoint logging"`

	CORS `namespace:"cors" group:"Cross Origin Resource Sharing (CORS) settings"`
	CSP  `namespace:"csp" group:"Content Security Policy (CSP) settings"`
}

Base are base API server options

func (*Base) GetBindAddress

func (b *Base) GetBindAddress() string

func (*Base) GetExternalAddress

func (b *Base) GetExternalAddress() string

type CORS

type CORS struct {
	AllowedOrigins   []string `long:"allowed-origins" description:"Allowed origins (defaults to external address or bind address)"`
	AllowedMethods   []string `long:"allowed-methods" description:"Allowed http methods" default:"GET,POST,PUT,UPDATE,OPTIONS"`
	AllowedHeaders   []string `long:"allowed-headers" description:"Allowed headers" default:"Content-Type"`
	AllowCredentials bool     `long:"allowed-credentials" description:"Allowed credentials"`
	NoCORS           bool     `long:"disable" description:"Disable CORS headers"`
}

CORS configuration options

type CSP

type CSP struct {
	ReportOnly  bool     `long:"report-only" description:"Sets CSP to report only mode"`
	DefaultSrc  []string `long:"default-src" description:"Default allowed sources" default:"'self'"`
	ScriptSrc   []string `long:"script-src" description:"Allowed script sources"`
	StyleSrc    []string `long:"style-src" description:"Allowed style sources"`
	ImgSrc      []string `long:"img-src" description:"Allowed img sources"`
	FontSrc     []string `long:"font-src" description:"Allowed font sources"`
	ChildSrc    []string `long:"child-src" description:"Allowed child sources"`
	ConnectSrc  []string `long:"connect-src" description:"Allowed connect sources"`
	FrameSrc    []string `long:"frame-src" description:"Allowed frame sources"`
	ManifestSrc []string `long:"manifest-src" description:"Allowed manifest sources"`
	MediaSrc    []string `long:"media-src" description:"Allowed media sources"`
	ObjectSrc   []string `long:"object-src" description:"Allowed object sources"`
	WorkerSrc   []string `long:"worker-src" description:"Allowed worker sources"`
	ReportTo    string   `long:"report-to" description:"ReportTo address" default:"/csp-report"`
	NoCSP       bool     `long:"disable" description:"Disable CSP headers"`
}

CSP configuration options

type Session

type Session struct {
	Secret        string `long:"secret" description:"Secret for session cookie encryption (defaults to a random key)"`
	DisableSecure bool   `long:"disable-secure" description:"Disable secure cookie flag (DEV USE ONLY)"`
}

type TLS

type TLS struct {
	TLSCert string `short:"c" long:"cert" description:"TLS certificate file"`
	TLSKey  string `short:"k" long:"key" description:"TLS key file"`
	NoTLS   bool   `long:"disable" description:"Disable TLS"`
}

TLS configuration options

Jump to

Keyboard shortcuts

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