sg: use same PG envvar copy for code insights (#45204)

Directly constructing a DSN is incorrect, since the user may have just
specified a DSN. Instead we need to copy over from the same format that
the user specified for connecting to frontend. This is the same approach
use by codeintel.

Test Plan: sg start enterprise-codeinsights works on my machine (did not
before).
This commit is contained in:
Keegan Carruthers-Smith 2022-12-06 05:41:14 +02:00 committed by GitHub
parent 52fefe5292
commit 010e3ed41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,8 +107,16 @@ env:
# This setting will be going away soon
DISABLE_CNCF: notonmybox
# Code Insights uses a separate database to architecturally isolate the component from the rest of Sourcegraph.
CODEINSIGHTS_PGDATASOURCE: postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$PGDATABASE
# Point code insights to the `frontend` database in development
CODEINSIGHTS_PGPORT: $PGPORT
CODEINSIGHTS_PGHOST: $PGHOST
CODEINSIGHTS_PGUSER: $PGUSER
CODEINSIGHTS_PGPASSWORD: $PGPASSWORD
CODEINSIGHTS_PGDATABASE: $PGDATABASE
CODEINSIGHTS_PGSSLMODE: $PGSSLMODE
CODEINSIGHTS_PGDATASOURCE: $PGDATASOURCE
# Disable code insights by default
DB_STARTUP_TIMEOUT: 120s # codeinsights-db needs more time to start in some instances.
DISABLE_CODE_INSIGHTS_HISTORICAL: true
DISABLE_CODE_INSIGHTS: true