repo-updater: init encryption and decrypt external service on read (#14652)

Co-authored-by: Tomás Senart <tomas@sourcegraph.com>
This commit is contained in:
ᴜɴᴋɴᴡᴏɴ 2020-10-14 16:35:04 +08:00 committed by GitHub
parent 69708e86cb
commit e7490b0283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -1403,7 +1403,7 @@ func scanExternalService(svc *ExternalService, s scanner) error {
&svc.ID,
&svc.Kind,
&svc.DisplayName,
&svc.Config,
&secret.StringValue{S: &svc.Config},
&svc.CreatedAt,
&dbutil.NullTime{Time: &svc.UpdatedAt},
&dbutil.NullTime{Time: &svc.DeletedAt},

View File

@ -30,6 +30,7 @@ import (
"github.com/sourcegraph/sourcegraph/internal/httpcli"
"github.com/sourcegraph/sourcegraph/internal/logging"
"github.com/sourcegraph/sourcegraph/internal/ratelimit"
"github.com/sourcegraph/sourcegraph/internal/secret"
"github.com/sourcegraph/sourcegraph/internal/trace"
"github.com/sourcegraph/sourcegraph/internal/tracer"
"github.com/sourcegraph/sourcegraph/schema"
@ -49,6 +50,11 @@ func Main(enterpriseInit EnterpriseInit) {
tracer.Init()
trace.Init(true)
err := secret.Init()
if err != nil {
log.Fatalf("Failed to initialize secrets encryption: %v", err)
}
clock := func() time.Time { return time.Now().UTC() }
// Syncing relies on access to frontend and git-server, so wait until they started up.