Documentation
¶
Overview ¶
Package config loads ghsyncd configuration from the environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DatabaseURL is the Postgres connection string (DATABASE_URL).
DatabaseURL string
// DatabaseAuth selects password or AWS RDS IAM authentication
// (DATABASE_AUTH).
DatabaseAuth DatabaseAuth
// HTTPAddr is the listen address for the ingress/health server (HTTP_ADDR).
HTTPAddr string
// GitHubAppID identifies the GitHub App installation (GITHUB_APP_ID).
GitHubAppID int64
// GitHubInstallationID is the single-org App installation
// (GITHUB_INSTALLATION_ID).
GitHubInstallationID int64
// GitHubOrgID is the constant organization identity stored on mirror rows
// (GITHUB_ORG_ID).
GitHubOrgID int64
// GitHubToken is a development/test escape hatch for fake GitHub. Production
// uses App credentials and installation-token caching.
GitHubToken string
// GitHubPrivateKeyPath points at the App's PEM key (GITHUB_PRIVATE_KEY_PATH).
GitHubPrivateKeyPath string
// GitHubWebhookSecret verifies X-Hub-Signature-256 (GITHUB_WEBHOOK_SECRET).
GitHubWebhookSecret string
// GitHubBaseURL overrides the GitHub API endpoint; used to point at the
// fake GitHub server in development and tests (GITHUB_BASE_URL).
GitHubBaseURL string
// WebhookMaxBodyBytes bounds ingress memory and storage per delivery
// (WEBHOOK_MAX_BODY_BYTES).
WebhookMaxBodyBytes int64
// DispatchBatchSize is the maximum deliveries claimed per transaction
// (DISPATCH_BATCH_SIZE).
DispatchBatchSize int
// DispatchMaxAttempts parks a poison delivery after this many
// classification attempts (DISPATCH_MAX_ATTEMPTS).
DispatchMaxAttempts int
// DispatchDebounce bounds webhook burst coalescing
// (DISPATCH_DEBOUNCE).
DispatchDebounce time.Duration
// DispatchPollInterval controls idle polling latency
// (DISPATCH_POLL_INTERVAL).
DispatchPollInterval time.Duration
// DispatchRulesFile optionally replaces the built-in dispatcher rule table
// with YAML/JSON data (DISPATCH_RULES_FILE).
DispatchRulesFile string
// FetchBatchWindow is the collection window for a pull-request GraphQL gang
// (FETCH_BATCH_WINDOW).
FetchBatchWindow time.Duration
// BackfillPageSize is the GitHub page size for resumable backfill work
// (BACKFILL_PAGE_SIZE).
BackfillPageSize int
// BudgetSweepFloor and BudgetEventFloor reserve installation rate-budget
// headroom for higher-priority request classes.
BudgetSweepFloor float64
BudgetEventFloor float64
// BudgetMaxConcurrent is the installation-wide GitHub request ceiling.
BudgetMaxConcurrent int
// BudgetRESTLimit and BudgetGraphQLLimit are pessimistic denominators until
// GitHub supplies authoritative rate-limit observations.
BudgetRESTLimit int64
BudgetGraphQLLimit int64
// BudgetSecondaryFallback is used when a secondary-limit response supplies
// no valid Retry-After value.
BudgetSecondaryFallback time.Duration
// BudgetLeaseTTL bounds failover after an ungraceful singleton exit.
BudgetLeaseTTL time.Duration
// BudgetLeaseRenewInterval controls budget lease renewal cadence.
BudgetLeaseRenewInterval time.Duration
// M4 C-R1 bounds and periodic schedules are runtime configuration rather
// than constants in the sweeper.
SweepOpenStackMaxStaleness time.Duration
SweepOpenPRMaxStaleness time.Duration
SweepRepoRulesMaxStaleness time.Duration
SweepClosedMaxStaleness time.Duration
SweepRepositoryListPeriod time.Duration
SweepPageSize int
// GapHealPeriod controls delivery-gap scan scheduling.
GapHealPeriod time.Duration
// GapWindow is the delivery history inspected by one healing run.
GapWindow time.Duration
// GapPageSize and GapMaxPages bound deliveries API work per run.
GapPageSize int
GapMaxPages int
// GapLeaseTTL bounds stale-owner failover for delivery-gap scans.
GapLeaseTTL time.Duration
// DriftPeriod controls semantic-drift scan scheduling.
DriftPeriod time.Duration
// DriftSampleSize bounds entities sampled per scan.
DriftSampleSize int
// DriftPageSize independently bounds drift pagination
// (DRIFT_PAGE_SIZE).
DriftPageSize int
// DriftResolvedRetention controls resolved-finding retention.
DriftResolvedRetention time.Duration
// RetentionPeriod controls bulky webhook/check-history pruning.
RetentionPeriod time.Duration
// RetentionAge is the minimum retained age.
RetentionAge time.Duration
// RetentionBatchSize bounds deletes per transaction.
RetentionBatchSize int
// M5 C-S/C-D maintenance settings.
// WatermarkRefresh controls leader step cadence.
WatermarkRefresh time.Duration
// WatermarkLeaseTTL bounds standby takeover time.
WatermarkLeaseTTL time.Duration
// WatermarkFenceTimeout bounds the exclusive writer-fence wait
// (STREAM_WATERMARK_FENCE_LOCK_TIMEOUT).
WatermarkFenceTimeout time.Duration
// StreamRetentionPeriod controls change-event pruning.
StreamRetentionPeriod time.Duration
// StreamRetentionAge is the minimum public event retention.
StreamRetentionAge time.Duration
// StreamRetentionBatch bounds event deletes per transaction.
StreamRetentionBatch int
// DeriverPollInterval bounds dirty-set poll fallback latency.
DeriverPollInterval time.Duration
// DeriverDirtyCap bounds scopes claimed per derivation pass.
DeriverDirtyCap int
}
Config is ghsyncd's validated environment-derived runtime surface.
func (Config) RequireDatabase ¶
RequireDatabase returns an error when the configuration lacks a database URL; commands that touch Postgres call this up front for a clear message.
func (Config) RequireFetchCredentials ¶
RequireFetchCredentials validates the credentials required by fetch roles.
func (Config) RequireWebhookSecret ¶
RequireWebhookSecret fails closed for an ingress role with no HMAC secret.
type DatabaseAuth ¶ added in v0.2.0
type DatabaseAuth string
DatabaseAuth selects how new Postgres connections authenticate.
const ( // DatabaseAuthPassword uses the password and existing behavior from // DATABASE_URL. DatabaseAuthPassword DatabaseAuth = "password" // DatabaseAuthRDSIAM generates a fresh AWS RDS IAM token per connection. DatabaseAuthRDSIAM DatabaseAuth = "rds-iam" )
func ParseDatabaseAuth ¶ added in v0.2.0
func ParseDatabaseAuth(value string) (DatabaseAuth, error)
ParseDatabaseAuth validates a DATABASE_AUTH value for commands that do not otherwise load ghsyncd's full runtime configuration.
Click to show internal directories.
Click to hide internal directories.