5858 publication_name: string ;
5959 slot_name: string ;
6060 useLocalTunnel: boolean ;
61+ is_replica: boolean ;
62+ primary: {
63+ ssl: boolean ;
64+ database: string ;
65+ hostname: string ;
66+ port: number ;
67+ username: string ;
68+ password: string ;
69+ };
6170 };
6271 export let errors: Record <string , any > = {};
6372 export let submitError: string | null = null ;
6978 export let showPgVersionWarning: boolean = false ;
7079 export let selfHosted: boolean = false ;
7180
72- let form = { ... database , ssl: true }; // Set default SSL to true
81+ let form = { ... database };
7382
7483 const isEdit = !! form .id ;
7584
@@ -490,6 +499,133 @@ sequin tunnel --ports=[your-local-port]:${form.name}`;
490499 {#if databaseErrors .ssl }
491500 <p class ="text-destructive text-sm" >{databaseErrors .ssl }</p >
492501 {/if }
502+
503+ <div class =" flex items-center gap-2" >
504+ <Switch id ="is_replica" bind:checked ={form .is_replica } />
505+ <Label for =" is_replica" class =" flex items-center" >
506+ Replica
507+ <Tooltip .Root openDelay ={200 }>
508+ <Tooltip .Trigger >
509+ <HelpCircle class =" inline-block h-4 w-4 text-gray-400 ml-1" />
510+ </Tooltip .Trigger >
511+ <Tooltip .Content class =" max-w-xs" >
512+ <p class =" text-sm text-gray-500" >
513+ <b >Replica</b >
514+ <br />
515+ When connecting a replica to Sequin, Sequin also needs to connect
516+ to the primary database.
517+ <a
518+ href =" https://docs.sequinstream.com/reference/databases#using-sequin-with-a-replica"
519+ target =" _blank"
520+ rel =" noopener noreferrer"
521+ class =" inline-flex items-center text-link hover:underline"
522+ >
523+ Learn more
524+ <ExternalLinkIcon class =" w-3 h-3 ml-1" />
525+ </a >
526+ </p >
527+ </Tooltip .Content >
528+ </Tooltip .Root >
529+ </Label >
530+ </div >
531+
532+ {#if form .is_replica }
533+ <div transition:slide class =" space-y-4 mt-2 bg-muted p-4 rounded-md" >
534+ <div class =" space-y-4" >
535+ <div class =" space-y-2" >
536+ <Label for =" primary_hostname" >Primary host</Label >
537+ <Input
538+ type =" text"
539+ id =" primary_hostname"
540+ placeholder =" example.com"
541+ bind:value ={form .primary .hostname }
542+ />
543+ {#if databaseErrors .primary ?.hostname }
544+ <p class =" text-destructive text-sm" >
545+ {databaseErrors .primary ?.hostname }
546+ </p >
547+ {/if }
548+ </div >
549+
550+ <div class =" space-y-2" >
551+ <Label for =" primary_port" >Primary port</Label >
552+ <Input
553+ type =" number"
554+ id =" primary_port"
555+ placeholder =" 5432"
556+ bind:value ={form .primary .port }
557+ />
558+ {#if databaseErrors .primary ?.port }
559+ <p class =" text-destructive text-sm" >
560+ {databaseErrors .primary ?.port }
561+ </p >
562+ {/if }
563+ </div >
564+
565+ <div class =" space-y-2" >
566+ <Label for =" primary_database" >Primary database</Label >
567+ <Input
568+ type =" text"
569+ id =" primary_database"
570+ placeholder =" postgres"
571+ bind:value ={form .primary .database }
572+ />
573+ {#if databaseErrors .primary ?.database }
574+ <p class =" text-destructive text-sm" >
575+ {databaseErrors .primary ?.database }
576+ </p >
577+ {/if }
578+ </div >
579+
580+ <div class =" space-y-2" >
581+ <Label for =" primary_username" >Primary username</Label >
582+ <Input
583+ type =" text"
584+ id =" primary_username"
585+ bind:value ={form .primary .username }
586+ />
587+ {#if databaseErrors .primary ?.username }
588+ <p class =" text-destructive text-sm" >
589+ {databaseErrors .primary ?.username }
590+ </p >
591+ {/if }
592+ </div >
593+
594+ <div class =" space-y-2" >
595+ <Label for =" primary_password" >Primary password</Label >
596+ <div class =" relative" >
597+ <Input
598+ type ={showPassword ? " text" : " password" }
599+ id =" primary_password"
600+ bind:value ={form .primary .password }
601+ />
602+ <button
603+ type =" button"
604+ class =" absolute inset-y-0 right-0 flex items-center pr-3"
605+ on:click ={togglePasswordVisibility }
606+ >
607+ {#if showPassword }
608+ <EyeOff class =" h-4 w-4 text-gray-400" />
609+ {:else }
610+ <Eye class =" h-4 w-4 text-gray-400" />
611+ {/if }
612+ </button >
613+ </div >
614+ {#if databaseErrors .primary ?.password }
615+ <p class =" text-destructive text-sm" >
616+ {databaseErrors .primary ?.password }
617+ </p >
618+ {/if }
619+ </div >
620+
621+ <div class =" flex items-center gap-2" >
622+ <Switch id ="primary_ssl" bind:checked ={form .primary .ssl } />
623+ <Label for =" primary_ssl" >Primary SSL</Label >
624+ </div >
625+ </div >
626+ </div >
627+ {/if }
628+
493629 {#if poolerType }
494630 <div transition:slide >
495631 <Alert variant =" default" >
@@ -543,6 +679,20 @@ sequin tunnel --ports=[your-local-port]:${form.name}`;
543679 <CardTitle >Replication configuration</CardTitle >
544680 </CardHeader >
545681 <CardContent >
682+ <div class =" space-y-2" >
683+ <Label for =" publication_name" >Publication name</Label >
684+ <Input
685+ type =" text"
686+ id =" publication_name"
687+ bind:value ={form .publication_name }
688+ />
689+ {#if replicationErrors .publication_name }
690+ <p class =" text-destructive text-sm" >
691+ {replicationErrors .publication_name }
692+ </p >
693+ {/if }
694+ </div >
695+
546696 <div class =" space-y-2" >
547697 <div class =" space-y-2" >
548698 <Label for =" slot_name" >Slot name</Label >
@@ -553,20 +703,6 @@ sequin tunnel --ports=[your-local-port]:${form.name}`;
553703 </p >
554704 {/if }
555705 </div >
556-
557- <div class =" space-y-2" >
558- <Label for =" publication_name" >Publication name</Label >
559- <Input
560- type =" text"
561- id =" publication_name"
562- bind:value ={form .publication_name }
563- />
564- {#if replicationErrors .publication_name }
565- <p class =" text-destructive text-sm" >
566- {replicationErrors .publication_name }
567- </p >
568- {/if }
569- </div >
570706 </div >
571707
572708 <div class =" mt-8" >
0 commit comments