@@ -12,8 +12,8 @@ import (
1212type Config struct {
1313 EnvFile string
1414 Port string
15- RepoName string
16- RepoOwner string
15+ ConfigRepoName string // Repository where config file is stored
16+ ConfigRepoOwner string // Owner of repository where config file is stored
1717 AppId string
1818 AppClientId string
1919 InstallationId string
@@ -22,7 +22,7 @@ type Config struct {
2222 ConfigFile string
2323 DeprecationFile string
2424 WebserverPath string
25- SrcBranch string
25+ ConfigRepoBranch string // Branch to fetch config file from
2626 PEMKeyName string
2727 WebhookSecretName string
2828 WebhookSecret string
@@ -60,8 +60,8 @@ type Config struct {
6060const (
6161 EnvFile = "ENV"
6262 Port = "PORT"
63- RepoName = "REPO_NAME "
64- RepoOwner = "REPO_OWNER "
63+ ConfigRepoName = "CONFIG_REPO_NAME "
64+ ConfigRepoOwner = "CONFIG_REPO_OWNER "
6565 AppId = "GITHUB_APP_ID"
6666 AppClientId = "GITHUB_APP_CLIENT_ID"
6767 InstallationId = "INSTALLATION_ID"
@@ -70,7 +70,7 @@ const (
7070 ConfigFile = "CONFIG_FILE"
7171 DeprecationFile = "DEPRECATION_FILE"
7272 WebserverPath = "WEBSERVER_PATH"
73- SrcBranch = "SRC_BRANCH "
73+ ConfigRepoBranch = "CONFIG_REPO_BRANCH "
7474 PEMKeyName = "PEM_NAME"
7575 WebhookSecretName = "WEBHOOK_SECRET_NAME"
7676 WebhookSecret = "WEBHOOK_SECRET"
@@ -106,7 +106,7 @@ func NewConfig() *Config {
106106 ConfigFile : "copier-config.yaml" ,
107107 DeprecationFile : "deprecated_examples.json" ,
108108 WebserverPath : "/webhook" ,
109- SrcBranch : "main" , // Default branch to copy from (NOTE: we are purposefully only allowing copying from `main` branch right now)
109+ ConfigRepoBranch : "main" , // Default branch to fetch config file from
110110 PEMKeyName : "projects/1054147886816/secrets/CODE_COPIER_PEM/versions/latest" , // default secret name for GCP Secret Manager
111111 WebhookSecretName : "projects/1054147886816/secrets/webhook-secret/versions/latest" , // default webhook secret name for GCP Secret Manager
112112 CopierLogName : "copy-copier-log" , // default log name for logging to GCP
@@ -152,8 +152,8 @@ func LoadEnvironment(envFile string) (*Config, error) {
152152
153153 // Populate config from environment variables, with defaults where applicable
154154 config .Port = getEnvWithDefault (Port , config .Port )
155- config .RepoName = os .Getenv (RepoName )
156- config .RepoOwner = os .Getenv (RepoOwner )
155+ config .ConfigRepoName = os .Getenv (ConfigRepoName )
156+ config .ConfigRepoOwner = os .Getenv (ConfigRepoOwner )
157157 config .AppId = os .Getenv (AppId )
158158 config .AppClientId = os .Getenv (AppClientId )
159159 config .InstallationId = os .Getenv (InstallationId )
@@ -162,7 +162,7 @@ func LoadEnvironment(envFile string) (*Config, error) {
162162 config .ConfigFile = getEnvWithDefault (ConfigFile , config .ConfigFile )
163163 config .DeprecationFile = getEnvWithDefault (DeprecationFile , config .DeprecationFile )
164164 config .WebserverPath = getEnvWithDefault (WebserverPath , config .WebserverPath )
165- config .SrcBranch = getEnvWithDefault (SrcBranch , config .SrcBranch )
165+ config .ConfigRepoBranch = getEnvWithDefault (ConfigRepoBranch , config .ConfigRepoBranch )
166166 config .PEMKeyName = getEnvWithDefault (PEMKeyName , config .PEMKeyName )
167167 config .WebhookSecretName = getEnvWithDefault (WebhookSecretName , config .WebhookSecretName )
168168 config .WebhookSecret = os .Getenv (WebhookSecret )
@@ -199,8 +199,8 @@ func LoadEnvironment(envFile string) (*Config, error) {
199199
200200 // Export resolved values back into environment so downstream os.Getenv sees defaults
201201 _ = os .Setenv (Port , config .Port )
202- _ = os .Setenv (RepoName , config .RepoName )
203- _ = os .Setenv (RepoOwner , config .RepoOwner )
202+ _ = os .Setenv (ConfigRepoName , config .ConfigRepoName )
203+ _ = os .Setenv (ConfigRepoOwner , config .ConfigRepoOwner )
204204 _ = os .Setenv (AppId , config .AppId )
205205 _ = os .Setenv (AppClientId , config .AppClientId )
206206 _ = os .Setenv (InstallationId , config .InstallationId )
@@ -209,7 +209,7 @@ func LoadEnvironment(envFile string) (*Config, error) {
209209 _ = os .Setenv (ConfigFile , config .ConfigFile )
210210 _ = os .Setenv (DeprecationFile , config .DeprecationFile )
211211 _ = os .Setenv (WebserverPath , config .WebserverPath )
212- _ = os .Setenv (SrcBranch , config .SrcBranch )
212+ _ = os .Setenv (ConfigRepoBranch , config .ConfigRepoBranch )
213213 _ = os .Setenv (PEMKeyName , config .PEMKeyName )
214214 _ = os .Setenv (CopierLogName , config .CopierLogName )
215215 _ = os .Setenv (GoogleCloudProjectId , config .GoogleCloudProjectId )
@@ -260,10 +260,10 @@ func validateConfig(config *Config) error {
260260 var missingVars []string
261261
262262 requiredVars := map [string ]string {
263- RepoName : config .RepoName ,
264- RepoOwner : config .RepoOwner ,
265- AppId : config .AppId ,
266- InstallationId : config .InstallationId ,
263+ ConfigRepoName : config .ConfigRepoName ,
264+ ConfigRepoOwner : config .ConfigRepoOwner ,
265+ AppId : config .AppId ,
266+ InstallationId : config .InstallationId ,
267267 }
268268
269269 for name , value := range requiredVars {
0 commit comments