@@ -34,21 +34,21 @@ type Config struct {
3434 DefaultPRMerge bool
3535 DefaultCommitMessage string
3636
37- // New features
38- DryRun bool
39- AuditEnabled bool
40- MongoURI string
41- MongoURISecretName string
42- AuditDatabase string
43- AuditCollection string
44- MetricsEnabled bool
37+ // Optional features
38+ DryRun bool
39+ AuditEnabled bool
40+ MongoURI string
41+ MongoURISecretName string
42+ AuditDatabase string
43+ AuditCollection string
44+ MetricsEnabled bool
4545
4646 // Slack notifications
47- SlackWebhookURL string
48- SlackChannel string
49- SlackUsername string
50- SlackIconEmoji string
51- SlackEnabled bool
47+ SlackWebhookURL string
48+ SlackChannel string
49+ SlackUsername string
50+ SlackIconEmoji string
51+ SlackEnabled bool
5252
5353 // GitHub API retry configuration
5454 GitHubAPIMaxRetries int
@@ -60,61 +60,61 @@ type Config struct {
6060}
6161
6262const (
63- EnvFile = "ENV"
64- Port = "PORT"
65- ConfigRepoName = "CONFIG_REPO_NAME"
66- ConfigRepoOwner = "CONFIG_REPO_OWNER"
67- AppId = "GITHUB_APP_ID"
68- AppClientId = "GITHUB_APP_CLIENT_ID"
69- InstallationId = "INSTALLATION_ID"
70- CommitterName = "COMMITTER_NAME"
71- CommitterEmail = "COMMITTER_EMAIL"
72- ConfigFile = "CONFIG_FILE"
73- MainConfigFile = "MAIN_CONFIG_FILE"
74- UseMainConfig = "USE_MAIN_CONFIG"
75- DeprecationFile = "DEPRECATION_FILE"
76- WebserverPath = "WEBSERVER_PATH"
77- ConfigRepoBranch = "CONFIG_REPO_BRANCH"
78- PEMKeyName = "PEM_NAME"
79- WebhookSecretName = "WEBHOOK_SECRET_NAME"
80- WebhookSecret = "WEBHOOK_SECRET"
81- CopierLogName = "COPIER_LOG_NAME"
82- GoogleCloudProjectId = "GOOGLE_CLOUD_PROJECT_ID"
83- DefaultRecursiveCopy = "DEFAULT_RECURSIVE_COPY"
84- DefaultPRMerge = "DEFAULT_PR_MERGE"
85- DefaultCommitMessage = "DEFAULT_COMMIT_MESSAGE"
86- DryRun = "DRY_RUN"
87- AuditEnabled = "AUDIT_ENABLED"
88- MongoURI = "MONGO_URI"
89- MongoURISecretName = "MONGO_URI_SECRET_NAME"
90- AuditDatabase = "AUDIT_DATABASE"
91- AuditCollection = "AUDIT_COLLECTION"
92- MetricsEnabled = "METRICS_ENABLED"
93- SlackWebhookURL = "SLACK_WEBHOOK_URL"
94- SlackChannel = "SLACK_CHANNEL"
95- SlackUsername = "SLACK_USERNAME"
96- SlackIconEmoji = "SLACK_ICON_EMOJI"
97- SlackEnabled = "SLACK_ENABLED"
98- GitHubAPIMaxRetries = "GITHUB_API_MAX_RETRIES"
99- GitHubAPIInitialRetryDelay = "GITHUB_API_INITIAL_RETRY_DELAY"
100- PRMergePollMaxAttempts = "PR_MERGE_POLL_MAX_ATTEMPTS"
101- PRMergePollInterval = "PR_MERGE_POLL_INTERVAL"
63+ EnvFile = "ENV"
64+ Port = "PORT"
65+ ConfigRepoName = "CONFIG_REPO_NAME"
66+ ConfigRepoOwner = "CONFIG_REPO_OWNER"
67+ AppId = "GITHUB_APP_ID"
68+ AppClientId = "GITHUB_APP_CLIENT_ID"
69+ InstallationId = "INSTALLATION_ID"
70+ CommitterName = "COMMITTER_NAME"
71+ CommitterEmail = "COMMITTER_EMAIL"
72+ ConfigFile = "CONFIG_FILE"
73+ MainConfigFile = "MAIN_CONFIG_FILE"
74+ UseMainConfig = "USE_MAIN_CONFIG"
75+ DeprecationFile = "DEPRECATION_FILE"
76+ WebserverPath = "WEBSERVER_PATH"
77+ ConfigRepoBranch = "CONFIG_REPO_BRANCH"
78+ PEMKeyName = "PEM_NAME"
79+ WebhookSecretName = "WEBHOOK_SECRET_NAME"
80+ WebhookSecret = "WEBHOOK_SECRET"
81+ CopierLogName = "COPIER_LOG_NAME"
82+ GoogleCloudProjectId = "GOOGLE_CLOUD_PROJECT_ID"
83+ DefaultRecursiveCopy = "DEFAULT_RECURSIVE_COPY"
84+ DefaultPRMerge = "DEFAULT_PR_MERGE"
85+ DefaultCommitMessage = "DEFAULT_COMMIT_MESSAGE"
86+ DryRun = "DRY_RUN"
87+ AuditEnabled = "AUDIT_ENABLED"
88+ MongoURI = "MONGO_URI"
89+ MongoURISecretName = "MONGO_URI_SECRET_NAME"
90+ AuditDatabase = "AUDIT_DATABASE"
91+ AuditCollection = "AUDIT_COLLECTION"
92+ MetricsEnabled = "METRICS_ENABLED"
93+ SlackWebhookURL = "SLACK_WEBHOOK_URL"
94+ SlackChannel = "SLACK_CHANNEL"
95+ SlackUsername = "SLACK_USERNAME"
96+ SlackIconEmoji = "SLACK_ICON_EMOJI"
97+ SlackEnabled = "SLACK_ENABLED"
98+ GitHubAPIMaxRetries = "GITHUB_API_MAX_RETRIES"
99+ GitHubAPIInitialRetryDelay = "GITHUB_API_INITIAL_RETRY_DELAY"
100+ PRMergePollMaxAttempts = "PR_MERGE_POLL_MAX_ATTEMPTS"
101+ PRMergePollInterval = "PR_MERGE_POLL_INTERVAL"
102102)
103103
104104// NewConfig returns a new Config instance with default values
105105func NewConfig () * Config {
106106 return & Config {
107- Port : "8080" ,
108- CommitterName : "Copier Bot" ,
109- CommitterEmail : "bot@example.com" ,
110- ConfigFile : "copier-config.yaml" ,
111- DeprecationFile : "deprecated_examples.json" ,
112- WebserverPath : "/webhook" ,
113- ConfigRepoBranch : "main" , // Default branch to fetch config file from
114- PEMKeyName : "projects/1054147886816/secrets/CODE_COPIER_PEM/versions/latest" , // default secret name for GCP Secret Manager
115- WebhookSecretName : "projects/1054147886816/secrets/webhook-secret/versions/latest" , // default webhook secret name for GCP Secret Manager
116- CopierLogName : "copy-copier-log" , // default log name for logging to GCP
117- GoogleCloudProjectId : "github-copy-code-examples" , // default project ID for logging to GCP
107+ Port : "8080" ,
108+ CommitterName : "Copier Bot" ,
109+ CommitterEmail : "bot@example.com" ,
110+ ConfigFile : "copier-config.yaml" ,
111+ DeprecationFile : "deprecated_examples.json" ,
112+ WebserverPath : "/webhook" ,
113+ ConfigRepoBranch : "main" , // Default branch to fetch config file from
114+ PEMKeyName : "projects/1054147886816/secrets/CODE_COPIER_PEM/versions/latest" , // default secret name for GCP Secret Manager
115+ WebhookSecretName : "projects/1054147886816/secrets/webhook-secret/versions/latest" , // default webhook secret name for GCP Secret Manager
116+ CopierLogName : "copy-copier-log" , // default log name for logging to GCP
117+ GoogleCloudProjectId : "github-copy-code-examples" , // default project ID for logging to GCP
118118 DefaultRecursiveCopy : true , // system-wide default for recursive copying that individual config entries can override.
119119 DefaultPRMerge : false , // system-wide default for PR merge without review that individual config entries can override.
120120 DefaultCommitMessage : "Automated PR with updated examples" , // default commit message used when per-config commit_message is absent.
@@ -178,7 +178,7 @@ func LoadEnvironment(envFile string) (*Config, error) {
178178 config .GoogleCloudProjectId = getEnvWithDefault (GoogleCloudProjectId , config .GoogleCloudProjectId )
179179 config .DefaultCommitMessage = getEnvWithDefault (DefaultCommitMessage , config .DefaultCommitMessage )
180180
181- // New features
181+ // Optional features
182182 config .DryRun = getBoolEnvWithDefault (DryRun , false )
183183 config .AuditEnabled = getBoolEnvWithDefault (AuditEnabled , false )
184184 config .MongoURI = os .Getenv (MongoURI )
0 commit comments