From 71eeaddbf8bf1ac8f9fd2c4f3de7d99114da5cb6 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 25 Dec 2023 01:41:00 +0700 Subject: [PATCH] fix(engine): encode datasource URI --- engine/lifecycle.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/lifecycle.go b/engine/lifecycle.go index 9fdd4062c..6d2af703d 100644 --- a/engine/lifecycle.go +++ b/engine/lifecycle.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "log" + "net/url" "os" "os/exec" "path" @@ -203,15 +204,16 @@ func (e *QueryEngine) GetEncodedDatasources() (string, error) { for i := range datasources { if env := datasources[i].URL.FromEnvVar; env != "" { - url := os.Getenv(env) - if url == "" { + uri := os.Getenv(env) + if uri == "" { log.Printf("WARNING: env var %s which was defined in the Prisma schema is not set", env) continue // return "", fmt.Errorf("env var %s which was defined in the Prisma schema is not set", env) } + uri = url.QueryEscape(uri) overrides = append(overrides, DatasourceOverride{ Name: datasources[i].Name.String(), - URL: url, + URL: uri, }) } else { overrides = append(overrides, DatasourceOverride{