svcrunner

package module
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 45 Imported by: 6

README

svcrunner

Go Reference License

Toolset for running http/grpc servers.

Documentation

Overview

svcrunner provides a runner framework for tasks, providing hooks for registering flags, running initialization, starting, and stopping. Registers signal handlers and provides configured observability tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Output  io.Writer
	Args    []string
	Environ []string
	NoExit  bool
}

func (Options) Run

func (o Options) Run(procs ...Process) error

type Process

type Process struct {
	Name     string
	Register RegFunc
	Init     RunFunc
	Start    RunFunc
	Stop     RunFunc
}

func NewGRPC

func NewGRPC(s *grpc.Server, reg RegFunc, init RunFunc) Process

func NewHTTP

func NewHTTP(s *http.Server, reg RegFunc, init RunFunc) Process

type RegFunc

type RegFunc func(*envflag.Config)

type RunFunc

type RunFunc func(context.Context, Tools) error

type Tools

type Tools struct {
	Log logr.Logger
	// contains filtered or unexported fields
}

Directories

Path Synopsis
envflag wraps flag.FlagSet, allowing values to be set from the environment, translating keys from `screaming.snake-case` to `SCREAMING_SNAKE_CASE`
envflag wraps flag.FlagSet, allowing values to be set from the environment, translating keys from `screaming.snake-case` to `SCREAMING_SNAKE_CASE`

Jump to

Keyboard shortcuts

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