config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugUserConfig

type DebugUserConfig struct {
	Mode     DebugUserMode
	Username string
	Password string
}

DebugUserConfig defines the API debug user configurations

func (*DebugUserConfig) Prepares

func (conf *DebugUserConfig) Prepares(mode Mode) error

Prepares sets defaults and validates the configurations

type DebugUserMode

type DebugUserMode string

DebugUserMode represents a debug user mode

const (
	// DebugUserUnset represents the default unset option value
	DebugUserUnset DebugUserMode = ""

	// DebugUserDisabled disables the debug user
	DebugUserDisabled DebugUserMode = "disabled"

	// DebugUserReadOnly enables the debug user in a read-only mode
	DebugUserReadOnly DebugUserMode = "read-only"

	// DebugUserRW enables the debug user in a read-write mode
	DebugUserRW DebugUserMode = "read-write"
)

func (DebugUserMode) Validate

func (md DebugUserMode) Validate() error

Validate returns an error if the value is invalid

type Duration

type Duration time.Duration

Duration represents a duration

func (*Duration) UnmarshalTOML

func (v *Duration) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

type File

type File struct {
	Mode                Mode                `toml:"mode"`
	PasswordHasher      PasswordHasher      `toml:"password-hasher"`
	SessionKeyGenerator SessionKeyGenerator `toml:"session-key-generator"`
	DB                  struct {
		Host string `toml:"host"`
	} `toml:"db"`
	Log struct {
		Debug string `toml:"debug"`
		Error string `toml:"error"`
	} `toml:"log"`
	Debug struct {
		Mode     string `toml:"mode"`
		Username string `toml:"username"`
		Password string `toml:"password"`
	} `toml:"debug"`
	Shield struct {
		Whitelist bool   `toml:"whitelist"`
		PersistTo string `toml:"persist-to"`
	} `toml:"shield"`
	TransportHTTP struct {
		Host              string   `toml:"host"`
		KeepAliveDuration Duration `toml:"keep-alive-duration"`
		Playground        bool     `toml:"playground"`
		TLS               struct {
			Enabled          bool             `toml:"enabled"`
			MinVersion       TLSVersion       `toml:"min-version"`
			CertificateFile  string           `toml:"certificate-file"`
			KeyFile          string           `toml:"key-file"`
			CurvePreferences []TLSCurveID     `toml:"curve-preferences"`
			CipherSuites     []TLSCipherSuite `toml:"cipher-suites"`
		} `toml:"tls"`
	} `toml:"transport-http"`
}

File represents a TOML encoded configuration file

type Mode

type Mode string

Mode defines the server mode

const (
	// ModeDebug represents the debug server mode
	ModeDebug Mode = "debug"

	// ModeBeta represents the beta server mode
	ModeBeta Mode = "beta"

	// ModeProduction represents the production server mode
	ModeProduction Mode = "production"
)

func (Mode) Validate

func (mode Mode) Validate() error

Validate returns an error if the mode is unknown

type PasswordHasher

type PasswordHasher string

PasswordHasher represents a password hasher identifier

func (*PasswordHasher) UnmarshalTOML

func (v *PasswordHasher) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

type ServerConfig

type ServerConfig struct {
	Mode                Mode
	DBHost              string
	Shield              ShieldConfig
	SessionKeyGenerator sesskeygen.SessionKeyGenerator
	PasswordHasher      passhash.PasswordHasher
	DebugUser           DebugUserConfig
	Transport           []transport.Server
	DebugLog            *log.Logger
	ErrorLog            *log.Logger
}

ServerConfig defines the API server configurations

func FromFile

func FromFile(path string) (*ServerConfig, error)

FromFile reads the configuration from a file

func (*ServerConfig) Prepare

func (conf *ServerConfig) Prepare() error

Prepare sets defaults and validates the configurations

type SessionKeyGenerator

type SessionKeyGenerator string

SessionKeyGenerator represents a session key generator identifier

func (*SessionKeyGenerator) UnmarshalTOML

func (v *SessionKeyGenerator) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

type ShieldConfig added in v1.3.0

type ShieldConfig struct {
	WhitelistEnabled    bool
	PersistencyFilePath string
}

ShieldConfig represents the GraphQL shield configuration

type TLSCipherSuite

type TLSCipherSuite uint16

TLSCipherSuite represents a TLS cipher suite

func (*TLSCipherSuite) UnmarshalTOML

func (v *TLSCipherSuite) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

type TLSCurveID

type TLSCurveID tls.CurveID

TLSCurveID represents a TLS curve identifier

func (*TLSCurveID) UnmarshalTOML

func (v *TLSCurveID) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

type TLSVersion

type TLSVersion uint16

TLSVersion represents a TLS protocol version

func (*TLSVersion) UnmarshalTOML

func (v *TLSVersion) UnmarshalTOML(val interface{}) error

UnmarshalTOML implements the TOML unmarshaler interface

Jump to

Keyboard shortcuts

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