From 010e3ed41d9816dca1068edd75de905975ea6010 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Tue, 6 Dec 2022 05:41:14 +0200 Subject: [PATCH] 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). --- sg.config.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sg.config.yaml b/sg.config.yaml index e0530f65b85..78d4d10df3d 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -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