config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config provides application configuration loaded from environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger() *slog.Logger

NewLogger creates a new structured logger. uses JSON format in Lambda, text format elsewhere. sets log level to debug when APP_DEBUG_ENABLED is true.

Types

type Config

type Config struct {
	DebugEnabled bool

	GitHubOrg           string
	GitHubWebhookSecret string
	GitHubBaseURL       string

	GitHubAppID         int64
	GitHubAppPrivateKey []byte
	GitHubInstallID     int64

	OktaDomain              string
	OktaClientID            string
	OktaPrivateKey          []byte
	OktaScopes              []string
	OktaBaseURL             string
	OktaSyncRules           []okta.SyncRule
	OktaGitHubUserField     string
	OktaSyncSafetyThreshold float64

	PRComplianceEnabled bool
	PRMonitoredBranches []string

	OktaOrphanedUserNotifications bool

	SlackEnabled bool
	SlackToken   string
	SlackChannel string
	SlackAPIURL  string

	BasePath string
}

Config holds all application configuration loaded from environment variables.

func NewConfig

func NewConfig() (*Config, error)

NewConfig loads configuration from environment variables. returns error if required values are missing or invalid. supports SSM parameter references in format: arn:aws:ssm:REGION:ACCOUNT:parameter/path/to/param

func NewConfigWithContext

func NewConfigWithContext(ctx context.Context) (*Config, error)

NewConfigWithContext loads configuration from environment variables with the given context. supports SSM parameter resolution with automatic decryption.

func (*Config) IsGitHubConfigured

func (c *Config) IsGitHubConfigured() bool

IsGitHubConfigured returns true if GitHub App credentials are configured.

func (*Config) IsOktaSyncEnabled

func (c *Config) IsOktaSyncEnabled() bool

IsOktaSyncEnabled returns true if Okta sync is fully configured.

func (*Config) IsPRComplianceEnabled

func (c *Config) IsPRComplianceEnabled() bool

IsPRComplianceEnabled returns true if PR compliance checking is enabled.

func (*Config) Redacted

func (c *Config) Redacted() RedactedConfig

Redacted returns a copy of the config with secrets redacted.

func (*Config) ShouldMonitorBranch

func (c *Config) ShouldMonitorBranch(branch string) bool

ShouldMonitorBranch returns true if the given branch should be monitored for PR compliance.

type RedactedConfig

type RedactedConfig struct {
	DebugEnabled bool `json:"debug_enabled"`

	GitHubOrg           string `json:"github_org"`
	GitHubWebhookSecret string `json:"github_webhook_secret"`
	GitHubBaseURL       string `json:"github_base_url"`

	GitHubAppID         int64  `json:"github_app_id"`
	GitHubAppPrivateKey string `json:"github_app_private_key"`
	GitHubInstallID     int64  `json:"github_install_id"`

	OktaDomain              string          `json:"okta_domain"`
	OktaClientID            string          `json:"okta_client_id"`
	OktaPrivateKey          string          `json:"okta_private_key"`
	OktaScopes              []string        `json:"okta_scopes"`
	OktaBaseURL             string          `json:"okta_base_url"`
	OktaSyncRules           []okta.SyncRule `json:"okta_sync_rules"`
	OktaGitHubUserField     string          `json:"okta_github_user_field"`
	OktaSyncSafetyThreshold float64         `json:"okta_sync_safety_threshold"`

	PRComplianceEnabled bool     `json:"pr_compliance_enabled"`
	PRMonitoredBranches []string `json:"pr_monitored_branches"`

	OktaOrphanedUserNotifications bool `json:"okta_orphaned_user_notifications"`

	SlackEnabled bool   `json:"slack_enabled"`
	SlackToken   string `json:"slack_token"`
	SlackChannel string `json:"slack_channel"`
	SlackAPIURL  string `json:"slack_api_url"`

	BasePath string `json:"base_path"`
}

RedactedConfig contains configuration with sensitive values redacted. safe for logging and API responses.

Jump to

Keyboard shortcuts

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