server

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(r *http.Request, status, size int, dur time.Duration)

func PromRequestHandler

func PromRequestHandler(handler http.Handler) http.Handler

Types

type Config

type Config struct {
	ListenAddr    string
	Logger        zerolog.Logger
	MetricsAddr   string
	Platform      platforms.Platform
	ProbeAddr     string
	WebhookSecret string
	Workers       int
}

Config hold configuration to run a server

type Server

type Server struct {
	CancelWorker chan struct{}
	Config       *Config
	Srv          *http.Server
	WorkerPool   *workers.WorkerPool
}

Server hold a server instance

func NewServer

func NewServer(config *Config) *Server

NewServer returns an instance of server

func (*Server) Start

func (s *Server) Start()

Start all components required to run a server

type WebhookHandler

type WebhookHandler struct {
	JobQueue      chan *workers.Job
	Platform      platforms.Platform
	WebhookSecret string
}

WebhookHandler hold webhook configuration

func NewWebhookHandler

func NewWebhookHandler(platform platforms.Platform, webhookSecret string, jobQueue chan *workers.Job) *WebhookHandler

NewWebhookHandler returns an instance of WebhookHandler

func (*WebhookHandler) GithubHandler

func (h *WebhookHandler) GithubHandler(w http.ResponseWriter, r *http.Request)

GithubHandler handle Github webhook requests

func (*WebhookHandler) GitlabHandler

func (h *WebhookHandler) GitlabHandler(w http.ResponseWriter, r *http.Request)

GitlabHandler handle Gitlab webhook requests

Jump to

Keyboard shortcuts

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