app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package app provides the core application logic for the GitHub bot. coordinates webhook processing, Okta sync, and PR compliance checks.

Package app provides HTTP handlers for webhook and status endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config       *config.Config
	Logger       *slog.Logger
	GitHubClient *github.Client
	OktaClient   *okta.Client
	Notifier     *notifiers.SlackNotifier
}

App is the main application instance containing all clients and configuration.

func New

func New(ctx context.Context, cfg *config.Config) (*App, error)

New creates a new App instance with configured clients. initializes GitHub, Okta, and Slack clients based on config.

func (*App) ConfigHandler

func (a *App) ConfigHandler(w http.ResponseWriter, r *http.Request)

ConfigHandler returns the application configuration with secrets redacted. useful for debugging and verifying environment settings.

func (*App) GetStatus

func (a *App) GetStatus() StatusResponse

GetStatus returns current application status and enabled features.

func (*App) ProcessScheduledEvent

func (a *App) ProcessScheduledEvent(ctx context.Context, evt ScheduledEvent) error

ProcessScheduledEvent handles scheduled events (e.g., cron jobs). routes to appropriate handlers based on event action.

func (*App) ProcessWebhook

func (a *App) ProcessWebhook(ctx context.Context, payload []byte, eventType string) error

ProcessWebhook handles incoming GitHub webhook events. supports pull_request, team, and membership events.

func (*App) StatusHandler

func (a *App) StatusHandler(w http.ResponseWriter, r *http.Request)

StatusHandler returns the application status and feature flags. responds with JSON containing configuration state and enabled features.

func (*App) WebhookHandler

func (a *App) WebhookHandler(w http.ResponseWriter, r *http.Request)

WebhookHandler processes incoming GitHub webhook POST requests. validates webhook signatures before processing events.

type ScheduledEvent

type ScheduledEvent struct {
	Action string          `json:"action"`
	Data   json.RawMessage `json:"data,omitempty"`
}

ScheduledEvent represents a generic scheduled event.

type StatusResponse

type StatusResponse struct {
	Status            string `json:"status"`
	GitHubConfigured  bool   `json:"github_configured"`
	OktaSyncEnabled   bool   `json:"okta_sync_enabled"`
	PRComplianceCheck bool   `json:"pr_compliance_check"`
	SlackEnabled      bool   `json:"slack_enabled"`
}

StatusResponse contains application status and feature flags.

Jump to

Keyboard shortcuts

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