server

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFlags

func ConfigFlags(cmd *cobra.Command) error

ConfigFlags helps configure cobra and viper flags.

func HTTPServerConfigFlags

func HTTPServerConfigFlags(cmd *cobra.Command, prefix string) error

HTTPServerConfigFlags helps configure cobra and viper flags.

func Run

func Run(ctx context.Context, config *Config) (err error)

Run starts the server with the given configuration

Types

type Config

type Config struct {
	HTTP        HTTPServerConfig `mapstructure:"http"`
	Runtime     *runtime.Config  `mapstructure:"runtime"`
	MTurkConfig *mturk.Config    `mapstructure:"mturk"`
	Admins      []admin.User     `mapstructure:"admins"`
	SecretKey   string           `mapstructure:"secret"`
	DevMode     bool             `mapstructure:"dev"`

	Store   *storage.Config `mapstructure:"store"`
	Metrics *metrics.Config `mapstructure:"metrics"`
	Logger  *log.Config     `mapstructure:"log"`
}

Config is `tawon agent` command line configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate configuration is ok

type HTTPServerConfig

type HTTPServerConfig struct {
	Addr    string `mapstructure:"addr"`
	RootURL string `mapstructure:"rooturl"`
	HTTPS   bool   `mapstructure:"https"`
	AutoTLS bool   `mapstructure:"autotls"`
	Debug   bool   `mapstructure:"debug"`
}

HTTPServerConfig is `tawon agent` command line configuration

func (*HTTPServerConfig) Validate

func (c *HTTPServerConfig) Validate() error

Validate configuration is ok

type SPABox

type SPABox struct {
	// contains filtered or unexported fields
}

SPABox implements http.FileSystem which allows the use of Box with a http.FileServer.

e.g.: http.Handle("/", http.FileServer(rice.MustFindBox("http-files").HTTPBox()))

func MakeSPABox

func MakeSPABox(box *rice.Box) *SPABox

MakeSPABox creates a new SPABox from an existing Box

func (*SPABox) Open

func (box *SPABox) Open(name string) (http.File, error)

Open returns a File using the http.File interface

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server encapsulates the state of running the server

Jump to

Keyboard shortcuts

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