Skip to content

Commit b5c4530

Browse files
committed
default db url
1 parent bb759ac commit b5c4530

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dbos/system_database.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"embed"
66
"errors"
77
"fmt"
8+
"net/url"
89
"os"
910
"strings"
1011
"time"
@@ -121,7 +122,9 @@ func NewSystemDatabase() (SystemDatabase, error) {
121122
// TODO: pass proper config
122123
databaseURL := os.Getenv("DBOS_DATABASE_URL")
123124
if databaseURL == "" {
124-
return nil, NewInitializationError("DBOS_DATABASE_URL environment variable is required")
125+
fmt.Println("DBOS_DATABASE_URL not set, using default: postgres://postgres:${PGPASSWORD}@localhost:5432/postgres?sslmode=disable")
126+
password := url.QueryEscape(os.Getenv("PGPASSWORD"))
127+
databaseURL = fmt.Sprintf("postgres://postgres:%s@localhost:5432/postgres?sslmode=disable", password)
125128
}
126129

127130
// Create the database if it doesn't exist

0 commit comments

Comments
 (0)