Skip to content

Commit

Permalink
fix(engine): encode datasource URI
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Dec 24, 2023
1 parent e97ad54 commit 71eeadd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engine/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"log"
"net/url"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 71eeadd

Please sign in to comment.