Documentation
¶
Index ¶
Constants ¶
View Source
const ( EnvFile = "ENV" Port = "PORT" ConfigRepoName = "CONFIG_REPO_NAME" ConfigRepoOwner = "CONFIG_REPO_OWNER" AppId = "GITHUB_APP_ID" AppClientId = "GITHUB_APP_CLIENT_ID" InstallationId = "INSTALLATION_ID" CommitterName = "COMMITTER_NAME" CommitterEmail = "COMMITTER_EMAIL" ConfigFile = "CONFIG_FILE" MainConfigFile = "MAIN_CONFIG_FILE" UseMainConfig = "USE_MAIN_CONFIG" DeprecationFile = "DEPRECATION_FILE" WebserverPath = "WEBSERVER_PATH" ConfigRepoBranch = "CONFIG_REPO_BRANCH" PEMKeyName = "PEM_NAME" // #nosec G101 -- env var name, not a credential WebhookSecretName = "WEBHOOK_SECRET_NAME" // #nosec G101 -- env var name, not a credential WebhookSecret = "WEBHOOK_SECRET" // #nosec G101 -- env var name, not a credential CopierLogName = "COPIER_LOG_NAME" GoogleCloudProjectId = "GOOGLE_CLOUD_PROJECT_ID" DefaultRecursiveCopy = "DEFAULT_RECURSIVE_COPY" DefaultPRMerge = "DEFAULT_PR_MERGE" DefaultCommitMessage = "DEFAULT_COMMIT_MESSAGE" DryRun = "DRY_RUN" AuditEnabled = "AUDIT_ENABLED" MongoURI = "MONGO_URI" MongoURISecretName = "MONGO_URI_SECRET_NAME" // #nosec G101 -- env var name, not a credential AuditDatabase = "AUDIT_DATABASE" AuditCollection = "AUDIT_COLLECTION" MetricsEnabled = "METRICS_ENABLED" SlackWebhookURL = "SLACK_WEBHOOK_URL" // #nosec G101 -- env var name, not a credential SlackChannel = "SLACK_CHANNEL" SlackUsername = "SLACK_USERNAME" SlackIconEmoji = "SLACK_ICON_EMOJI" SlackEnabled = "SLACK_ENABLED" SlackPlainText = "SLACK_PLAIN_TEXT" // Use for Workflow Builder webhooks SlackMessageVariable = "SLACK_MESSAGE_VARIABLE" // Variable name for Workflow Builder (default: "text") GitHubAPIMaxRetries = "GITHUB_API_MAX_RETRIES" GitHubAPIInitialRetryDelay = "GITHUB_API_INITIAL_RETRY_DELAY" PRMergePollMaxAttempts = "PR_MERGE_POLL_MAX_ATTEMPTS" PRMergePollInterval = "PR_MERGE_POLL_INTERVAL" ConfigCacheTTLSeconds = "CONFIG_CACHE_TTL_SECONDS" WebhookProcessingTimeoutSeconds = "WEBHOOK_PROCESSING_TIMEOUT_SECONDS" WebhookMaxRetries = "WEBHOOK_MAX_RETRIES" WebhookRetryInitialDelay = "WEBHOOK_RETRY_INITIAL_DELAY" //nolint:gosec // env var name, not a credential OperatorUIEnabled = "OPERATOR_UI_ENABLED" OperatorAuthRepo = "OPERATOR_AUTH_REPO" // repo for GitHub PAT permission check OperatorRepoSlug = "OPERATOR_REPO_SLUG" OperatorReleaseGitHubToken = "OPERATOR_RELEASE_GITHUB_TOKEN" // #nosec G101 -- env var name OperatorReleaseTargetBranch = "OPERATOR_RELEASE_TARGET_BRANCH" LLMProvider = "LLM_PROVIDER" LLMBaseURL = "LLM_BASE_URL" LLMModel = "LLM_MODEL" AnthropicAPIKey = "ANTHROPIC_API_KEY" // #nosec G101 -- env var name, not a credential AnthropicAPIKeySecretName = "ANTHROPIC_API_KEY_SECRET_NAME" // #nosec G101 -- env var name, not a credential )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
EnvFile string
Port string
ConfigRepoName string // Repository where config file is stored
ConfigRepoOwner string // Owner of repository where config file is stored
AppId string
AppClientId string
InstallationId string
CommitterName string
CommitterEmail string
ConfigFile string
MainConfigFile string // Main config file with workflow references (optional)
UseMainConfig bool // Whether to use main config format
DeprecationFile string
WebserverPath string
ConfigRepoBranch string // Branch to fetch config file from
PEMKeyName string
WebhookSecretName string
WebhookSecret string
CopierLogName string
GoogleCloudProjectId string
DefaultRecursiveCopy bool
DefaultPRMerge bool
DefaultCommitMessage string
// Optional features
DryRun bool
AuditEnabled bool
MongoURI string
MongoURISecretName string
AuditDatabase string
AuditCollection string
MetricsEnabled bool
// Slack notifications
SlackWebhookURL string
SlackChannel string
SlackUsername string
SlackIconEmoji string
SlackEnabled bool
SlackPlainText bool // Use plain text only (required for Workflow Builder webhooks)
SlackMessageVariable string // Variable name for Workflow Builder webhooks (default: "text")
// GitHub API retry configuration
GitHubAPIMaxRetries int
GitHubAPIInitialRetryDelay int // in milliseconds
// PR merge polling configuration
PRMergePollMaxAttempts int
PRMergePollInterval int // in milliseconds
// Config cache TTL in seconds (0 = disabled)
ConfigCacheTTLSeconds int
// Webhook background processing timeout in seconds (0 = no timeout)
WebhookProcessingTimeoutSeconds int
// Webhook retry configuration
WebhookMaxRetries int // max retry attempts for failed webhook processing
WebhookRetryInitialDelay int // initial delay between retries in seconds (doubles each attempt)
// Operator web UI — off unless OPERATOR_UI_ENABLED=true. Works with any HTTP
// origin (local dev, Cloud Run, etc.). Access is gated by GitHub PATs:
// each user authenticates with their personal token, and the role
// (operator or writer) is determined by their permission on OPERATOR_AUTH_REPO.
OperatorUIEnabled bool
OperatorAuthRepo string // "owner/repo" — user permissions here determine role (required when UI is enabled)
OperatorRepoSlug string // "owner/repo" for GitHub links in audit/trace rows (optional)
OperatorReleaseGitHubToken string // PAT with contents:write to create a version tag (optional)
OperatorReleaseTargetBranch string // branch SHA used when creating a tag (default main)
// AI rule suggestion (optional) — LLM-powered rule generation in the operator UI.
// The feature is available whenever the LLM provider is reachable at runtime;
// operators can change the active model and base URL from the UI without restart.
LLMProvider string // "ollama" (local) or "anthropic" (hosted)
LLMBaseURL string // initial default; overridable from the UI
LLMModel string // initial default; overridable from the UI
// Anthropic API key — required when LLMProvider="anthropic". Loaded from
// Secret Manager via AnthropicAPIKeySecretName, or directly via
// ANTHROPIC_API_KEY for local dev.
AnthropicAPIKey string
AnthropicAPIKeySecretName string
}
Config holds all environment configuration
func LoadEnvironment ¶
LoadEnvironment loads environment variables and returns populated Config
func NewConfig ¶
func NewConfig() *Config
NewConfig returns a new Config instance with default values
func (*Config) EffectiveConfigFile ¶
EffectiveConfigFile returns the config file path that the app will actually use. If MainConfigFile is set (USE_MAIN_CONFIG=true), it takes precedence over ConfigFile.
func (*Config) SecretPath ¶
SecretPath resolves a secret name to a fully-qualified GCP Secret Manager resource path. If the name already contains "projects/", it is returned as-is (for backward compatibility). Otherwise, it builds the full path using the configured GoogleCloudProjectId.
Click to show internal directories.
Click to hide internal directories.