server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server is the base server for the github metrics ingestion.

Index

Constants

View Source
const (
	// SHA256SignatureHeader is the GitHub header key used to pass the HMAC-SHA256 hexdigest.
	SHA256SignatureHeader = "X-Hub-Signature-256"
	// EventTypeHeader is the GitHub header key used to pass the event type.
	EventTypeHeader = "X-Github-Event"
	// DeliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event.
	DeliveryIDHeader = "X-Github-Delivery"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubMetricsAggregatorServer

type GitHubMetricsAggregatorServer struct {
	// contains filtered or unexported fields
}

GitHubMetricsAggregatorServer provides the server implementation.

func NewServer

func NewServer(ctx context.Context, cfg *ServiceConfig, pubsubClientOpts ...option.ClientOption) (*GitHubMetricsAggregatorServer, error)

NewServer creates a new HTTP server implementation that will handle receiving webhook payloads.

func (*GitHubMetricsAggregatorServer) Cleanup

func (s *GitHubMetricsAggregatorServer) Cleanup() error

Cleanup handles the graceful shutdown of the webhook server.

func (*GitHubMetricsAggregatorServer) Routes

Routes creates a ServeMux of all of the routes that this Router supports.

type PubSubClientConfig

type PubSubClientConfig struct {
	PubSubURL      string
	PubSubGRPCConn *grpc.ClientConn
}

PubSubClientConfig are the pubsub client config options.

type PubSubMessenger

type PubSubMessenger struct {
	// contains filtered or unexported fields
}

PubSubMessenger implements the Messenger interface for Google Cloud pubsub.

func NewPubSubMessenger

func NewPubSubMessenger(ctx context.Context, projectID, topicID string, opts ...option.ClientOption) (*PubSubMessenger, error)

NewPubSubMessenger creates a new instance of the PubSubMessenger.

func (*PubSubMessenger) Cleanup

func (p *PubSubMessenger) Cleanup() error

Cleanup handles the graceful shutdown of the pubsub client.

func (*PubSubMessenger) Send

func (p *PubSubMessenger) Send(ctx context.Context, msg []byte) error

Send sends a message to a Google Cloud pubsub topic.

type ServiceConfig

type ServiceConfig struct {
	Port          string `env:"PORT,default=8080"`
	ProjectID     string `env:"PROJECT_ID,required"`
	TopicID       string `env:"TOPIC_ID,required"`
	WebhookSecret string `env:"WEBHOOK_SECRET,required"`
}

ServiceConfig defines the set over environment variables required for running this application.

func NewConfig

func NewConfig(ctx context.Context) (*ServiceConfig, error)

NewConfig creates a new ServiceConfig from environment variables.

func (*ServiceConfig) Validate

func (s *ServiceConfig) Validate() error

Validate validates the service config after load.

Jump to

Keyboard shortcuts

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