Documentation
¶
Overview ¶
Package server is the base server for the github metrics ingestion.
Index ¶
Constants ¶
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 ¶
func (s *GitHubMetricsAggregatorServer) Routes() http.Handler
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.
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.