File tree Expand file tree Collapse file tree 5 files changed +62
-2
lines changed Expand file tree Collapse file tree 5 files changed +62
-2
lines changed Original file line number Diff line number Diff line change 4242 "@types/react-dom" : " 19" ,
4343 "@workflow/core" : " workspace:*" ,
4444 "@workflow/world" : " workspace:*" ,
45+ "@workflow/world-postgres" : " workspace:*" ,
4546 "@workflow/web-shared" : " workspace:*" ,
4647 "class-variance-authority" : " 0.7.1" ,
4748 "clsx" : " 2.1.1" ,
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export function SettingsSidebar() {
3232
3333 const backend = localConfig . backend || 'embedded' ;
3434 const isEmbedded = backend === 'embedded' ;
35+ const isPostgres = backend === 'postgres' ;
3536
3637 // Update local config when query params change
3738 useEffect ( ( ) => {
@@ -123,6 +124,7 @@ export function SettingsSidebar() {
123124 < SelectContent >
124125 < SelectItem value = "embedded" > Embedded</ SelectItem >
125126 < SelectItem value = "vercel" > Vercel</ SelectItem >
127+ < SelectItem value = "postgres" > PostgreSQL</ SelectItem >
126128 </ SelectContent >
127129 </ Select >
128130 </ div >
@@ -175,7 +177,33 @@ export function SettingsSidebar() {
175177 </ >
176178 ) }
177179
178- { ! isEmbedded && (
180+ { isPostgres && (
181+ < >
182+ < div className = "space-y-2" >
183+ < Label htmlFor = "postgresUrl" > Connection URL</ Label >
184+ < Input
185+ id = "postgresUrl"
186+ value = { localConfig . postgresUrl || '' }
187+ onChange = { ( e ) =>
188+ handleInputChange ( 'postgresUrl' , e . target . value )
189+ }
190+ placeholder = "postgres://user:pass@host:5432/db"
191+ className = {
192+ getFieldError ( 'postgresUrl' )
193+ ? 'border-destructive'
194+ : ''
195+ }
196+ />
197+ { getFieldError ( 'postgresUrl' ) && (
198+ < p className = "text-sm text-destructive" >
199+ { getFieldError ( 'postgresUrl' ) }
200+ </ p >
201+ ) }
202+ </ div >
203+ </ >
204+ ) }
205+
206+ { ! isEmbedded && ! isPostgres && (
179207 < >
180208 < div className = "space-y-2" >
181209 < Label htmlFor = "env" > Environment</ Label >
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ export interface WorldConfig {
1111 team ?: string ;
1212 port ?: string ;
1313 dataDir ?: string ;
14+ // Postgres fields
15+ postgresUrl ?: string ;
1416}
1517
1618export interface ValidationError {
@@ -49,5 +51,24 @@ export async function validateWorldConfig(
4951 }
5052 }
5153
54+ if ( backend === 'postgres' ) {
55+ // Validate postgres connection string
56+ if ( ! config . postgresUrl ) {
57+ errors . push ( {
58+ field : 'postgresUrl' ,
59+ message : 'PostgreSQL connection string is required' ,
60+ } ) ;
61+ } else if (
62+ ! config . postgresUrl . startsWith ( 'postgres://' ) &&
63+ ! config . postgresUrl . startsWith ( 'postgresql://' )
64+ ) {
65+ errors . push ( {
66+ field : 'postgresUrl' ,
67+ message :
68+ 'Invalid PostgreSQL connection string format (must start with postgres:// or postgresql://)' ,
69+ } ) ;
70+ }
71+ }
72+
5273 return errors ;
5374}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const CONFIG_PARAM_KEYS = [
2222 'team' ,
2323 'port' ,
2424 'dataDir' ,
25+ 'postgresUrl' ,
2526] as const ;
2627
2728/**
@@ -132,13 +133,19 @@ export function buildUrlWithConfig(
132133}
133134
134135export const worldConfigToEnvMap = ( config : WorldConfig ) : EnvMap => {
136+ const isPostgres = config . backend === 'postgres' ;
137+
135138 return {
136- WORKFLOW_TARGET_WORLD : config . backend ,
139+ WORKFLOW_TARGET_WORLD : isPostgres
140+ ? '@workflow/world-postgres'
141+ : config . backend ,
137142 WORKFLOW_VERCEL_ENV : config . env ,
138143 WORKFLOW_VERCEL_AUTH_TOKEN : config . authToken ,
139144 WORKFLOW_VERCEL_PROJECT : config . project ,
140145 WORKFLOW_VERCEL_TEAM : config . team ,
141146 PORT : config . port ,
142147 WORKFLOW_EMBEDDED_DATA_DIR : config . dataDir ,
148+ // Postgres env vars
149+ WORKFLOW_POSTGRES_URL : config . postgresUrl ,
143150 } ;
144151} ;
You can’t perform that action at this time.
0 commit comments