config

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles environment variable parsing and validation for the ecs-arc controller. It produces a typed Config struct from environment variables, with no AWS or GitHub API calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// GitHubAppClientID is the GitHub App Client ID (e.g. "Iv1.abc123").
	GitHubAppClientID string
	// GitHubAppInstallationID is the installation ID of the GitHub App.
	GitHubAppInstallationID int64
	// GitHubAppPrivateKey is the PEM-encoded private key of the GitHub App.
	GitHubAppPrivateKey string
	// GitHubOrg is the GitHub organization name.
	GitHubOrg string
	// GitHubConfigURL is derived from GitHubOrg: "https://github.com/{org}".
	GitHubConfigURL string

	// ScaleSetNamePrefix is an optional prefix for scale set names.
	// When set, scale set names become "{prefix}-{taskDefFamily}".
	ScaleSetNamePrefix string

	// ECSCluster is the ECS cluster name or ARN.
	ECSCluster string

	// SSMParameterName is the SSM Parameter Store parameter that holds the TOML runner config.
	SSMParameterName string
	// TOMLConfigFile is a local filesystem path holding the TOML runner config.
	// Exactly one of TOMLConfigFile or SSMParameterName must be set.
	TOMLConfigFile string
	// SSMPollInterval is how often to poll SSM for config changes.
	SSMPollInterval time.Duration

	// RunnerExecutionRoleARN is the IAM execution role ARN for runner task definitions.
	RunnerExecutionRoleARN string
	// RunnerTaskRoleARN is the IAM task role ARN for runner task definitions.
	RunnerTaskRoleARN string
	// RunnerLogGroup is the CloudWatch log group for runner containers.
	RunnerLogGroup string

	// RunnerExtraLabels are additional GitHub Actions labels to apply to every
	// runner scale set. Comma-separated list of label names.
	RunnerExtraLabels []string

	// GitHubAppID is the numeric GitHub App ID (distinct from the string
	// GitHubAppClientID). Required for the go-github REST client used by
	// the offline runner reaper.
	GitHubAppID int64

	// OfflineRunnerReaperInterval controls how often the controller's backstop
	// reaper sweeps GitHub for offline runner registrations. Default 30m.
	OfflineRunnerReaperInterval time.Duration
	// OfflineRunnerMinAge is the minimum time a runner must be observed
	// offline before the reaper is allowed to deregister it. Default 1h.
	OfflineRunnerMinAge time.Duration
}

Config holds all configuration for the ecs-arc controller.

func Load

func Load() (*Config, error)

Load reads configuration from environment variables and returns a validated Config. It returns an error if any required variable is missing or invalid.

func (*Config) ScaleSetName

func (c *Config) ScaleSetName(taskDefFamily string) string

ScaleSetName returns the scale set name for a given task definition family. If ScaleSetNamePrefix is set, the name is "{prefix}-{family}". Otherwise, the name is just the family name.

Jump to

Keyboard shortcuts

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