Skip to content

Commit

Permalink
fix(server): use configurable DB secret name instead of hardcoding (#…
Browse files Browse the repository at this point in the history
…1359)

* fix: add secret db to env
  • Loading branch information
nourbalaha authored Jan 17, 2025
1 parent b271769 commit a6f1815
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ REEARTH_CMS_TASK_DECOMPRESSORTOPIC=
REEARTH_CMS_TASK_DECOMPRESSORGZIPEXT=
REEARTH_CMS_TASK_DECOMPRESSORMACHINETYPE=
REEARTH_CMS_TASK_COPIERIMAGE=
REEARTH_CMS_TASK_DBSECRETNAME=

#AWS
REEARTH_CMS_AWSTASK_TOPICARN=
Expand Down
1 change: 1 addition & 0 deletions server/internal/infrastructure/gcp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ type TaskConfig struct {
DecompressorMachineType string `default:"E2_HIGHCPU_8"`
DecompressorDiskSideGb int64 `default:"2000"`
CopierImage string `default:"reearth/reearth-cms-copier"`
DBSecretName string `default:"reearth-cms-db"`
}
3 changes: 2 additions & 1 deletion server/internal/infrastructure/gcp/taskrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func copy(ctx context.Context, p task.Payload, conf *TaskConfig) error {

project := conf.GCPProject
region := conf.GCPRegion
dbSecretName := conf.DBSecretName

build := &cloudbuild.Build{
Timeout: "86400s", // 1 day
Expand All @@ -179,7 +180,7 @@ func copy(ctx context.Context, p task.Payload, conf *TaskConfig) error {
AvailableSecrets: &cloudbuild.Secrets{
SecretManager: []*cloudbuild.SecretManagerSecret{
{
VersionName: fmt.Sprintf("projects/%s/secrets/reearth-cms-db/versions/latest", project),
VersionName: fmt.Sprintf("projects/%s/secrets/%s/versions/latest", project, dbSecretName),
Env: "REEARTH_CMS_WORKER_DB",
},
},
Expand Down

0 comments on commit a6f1815

Please sign in to comment.