restapi

package
v0.0.0-...-ae1d368 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoveryHandler

func RecoveryHandler() func(handler http.Handler) http.Handler

func UUIDWrapper

func UUIDWrapper(next http.Handler) http.Handler

Types

type ACMEParameters

type ACMEParameters struct {
	Enabled   bool   `param:"desc=Enable ACME Certificates (aka Let's Encrypt) for host;default=false"`
	Hosts     string `param:"desc=ACME host names;default=geo.exploratory.engineering,geo.nbiot.engineering,api.geo.telenor.io"`
	SecretDir string `param:"desc=ACME secrets directory;default=/var/geo/autocert"`
}

func (*ACMEParameters) HostList

func (p *ACMEParameters) HostList() []string

HostList returns the list of hosts

type RestAPIParams

type RestAPIParams struct {
	Endpoint    string `param:"desc=Listen address for HTTP server;default=localhost:8080"`
	TLSKeyFile  string `param:"desc=TLS key file;file"`
	TLSCertFile string `param:"desc=TLS certificate file;file"`
	ACME        ACMEParameters
	AccessLog   string `param:"desc=Access log file name;default=access_log"`
}

type Server

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

Server contains everything needed to run a geoserver

func New

func New(params RestAPIParams, manager manager.Manager, store store.Store, authenticator *auth.Authenticator) *Server

New creates a new HTTP server instance for serving the REST API

func (*Server) AuthTypeKeyFromRequest

func (s *Server) AuthTypeKeyFromRequest(r *http.Request) auth.AuthProvider

AuthTypeKeyFromRequest returns the user auth type

func (*Server) RequestLogger

func (s *Server) RequestLogger(r *http.Request) *log.Entry

RequestLogger returns a populated logger with an unique UUID for the request along with user info if present

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

func (*Server) UserFromRequest

func (s *Server) UserFromRequest(r *http.Request) *model.User

UserFromRequest returns the User model of the currenly logged in user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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