connectgo

package
v0.0.0-...-64e57e2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package connectgo implements utilities for building and serving neutral-diet services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnectWrapper

func NewConnectWrapper(
	s *db.Store,
	a *auth.Client,
	m *messaging.Client,
) *service.ConnectWrapper

NewConnectWrapper creates a service.ConnectWrapper instance

func RegisterConnectGoServer

func RegisterConnectGoServer(in RegisterConnectGoServerInput)

RegisterConnectGoServer registers the handlers for the connect-go server.

Types

type Config

type Config struct {
	ConnectConfig *ConnectConfig `env:",prefix=GRPC_CONNECT_"`
}

Config represents the configuration settings for the connect-go server.

func NewConfig

func NewConfig() (cfg Config, err error)

NewConfig reads connect-go configuration settings from environment variables.

type ConnectConfig

type ConnectConfig struct {
	Port            int           `env:"PORT,default=8080"`
	ShutdownTimeout time.Duration `env:"TIMEOUT,default=3s"`
}

ConnectConfig represents the connection settings for the connect-go server.

type RegisterConnectGoServerInput

type RegisterConnectGoServerInput struct {
	Logger     *zerolog.Logger
	ConnectSvc *service.ConnectWrapper
	Mux        *http.ServeMux `name:"connectGoMux"`
	AuthClient *auth.Client
}

RegisterConnectGoServerInput represents the input to the RegisterConnectGoServer function.

type Server

type Server struct {
	Server *http.Server

	Mux             *http.ServeMux
	ShutdownTimeout time.Duration
	// contains filtered or unexported fields
}

A Server represents a HTTP server with a shutdown timer.

func NewConnectGoServer

func NewConnectGoServer(
	logger *zerolog.Logger,
	cfg Config,
) *Server

NewConnectGoServer starts and returns server. Adds HTTP logger handlers to Mux.

func (*Server) Notify

func (s *Server) Notify() <-chan error

Notify returns the notify channel

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown shuts down the server after all connections active are finished

Jump to

Keyboard shortcuts

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