api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package api provides an http server for governor

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	AdminGroups []string
	AuthConf    []ginjwt.AuthConfig
	Debug       bool
	Listen      string
	Logger      *zap.Logger
}

Conf allows other packages to compose their api configuration and use our NewAPI factor to put it together for them

type Server

type Server struct {
	AuthMW         *ginauth.MultiTokenMiddleware
	Conf           *Conf
	DB             *sqlx.DB
	Router         *gin.Engine
	AuditLogWriter io.Writer

	EventBus *eventbus.Client
	// contains filtered or unexported fields
}

Server holds data necessary to run the API and has associated methods

func (*Server) NewAPI

func (s *Server) NewAPI() *http.Server

NewAPI returns an http Server constructed from an api.Server object

func (*Server) Run

func (s *Server) Run() error

Run will start the server listening on the specified address

Jump to

Keyboard shortcuts

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