server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package server provides an helper type that provides access to cloud features, error handling, logging and configuration management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Logger *log.Logger // the logger
	// contains filtered or unexported fields
}

Server holds cloud features clients, a logger and the configuration.

func NewServer

func NewServer(
	cfg config.Config,
	serviceName string,
	featureProvider ...features.FeatureProvider,
) (*Server, error)

NewServer creates a new server. It setup a dedicated logger using the serviceName parameter. A custom feature provider can be given. If 0, or more than one is given, it will fallback to the default provider. The default provider includes a metadata client, the error reporting and the secret manager.

func (*Server) Close

func (s *Server) Close() error

Close terminates the server clients. If the server is not running on a Cloud environment, it does nothing and returns nil.

func (*Server) Raise

func (s *Server) Raise(message string, err error, req *http.Request)

Raise logs the error and report it using the ErrorReporting cloud feature. The reporting is only available when in a Clouc environment.

Directories

Path Synopsis
Package features provides an interface to implement custom cloud features.
Package features provides an interface to implement custom cloud features.

Jump to

Keyboard shortcuts

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