Skip to content

Commit

Permalink
fix: Read secrets from new collection (#98)
Browse files Browse the repository at this point in the history
Pairing Bot holds many secrets, and some of them are config values!

Right now, those config secrets are stored in single-document
collections that (in my experience) have names that don't clearly map to
their usage.

This starts reading them all out of a new collection named "secrets",
and each document contains a single secret token.

I've already copied the secrets to their new locations, which can be
verified in the Google Cloud console for both environments. (The RC API
access token won't match, though, because I generated a new one out of
my RC account.)

After both the dev and prod bots deploy successfully, I'll delete the
old unused secret collections.
  • Loading branch information
jdkaplan authored Oct 11, 2024
1 parent d8cb70d commit da08d86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func main() {
}

zulipCredentials := func(ctx context.Context) (zulip.Credentials, error) {
password, err := adb.GetToken(ctx, "apiauth/key")
password, err := adb.GetToken(ctx, "secrets/zulip_api_key")
if err != nil {
return zulip.Credentials{}, err
}
Expand All @@ -102,7 +102,7 @@ func main() {
}

recurseAccessToken := func(ctx context.Context) (recurse.AccessToken, error) {
token, err := adb.GetToken(ctx, "rc-accesstoken/key")
token, err := adb.GetToken(ctx, "secrets/recurse_access_token")
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion pairing_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (pl *PairingLogic) handle(w http.ResponseWriter, r *http.Request) {

log.Println("Handling a new Zulip request")

botAuth, err := pl.adb.GetToken(ctx, "botauth/token")
botAuth, err := pl.adb.GetToken(ctx, "secrets/zulip_webhook_token")
if err != nil {
log.Println("Something weird happened trying to read the auth token from the database")
}
Expand Down

0 comments on commit da08d86

Please sign in to comment.