2323 serverURL string
2424 verbose bool
2525 dryRun bool
26+ setPublic bool
2627 timeout int
2728 logger * zap.Logger
2829 inspectTraffic bool
@@ -302,7 +303,15 @@ func runPushSync(localPath string, remotePath string) error {
302303 Server : serverURL ,
303304 }
304305 } else {
305- serverURL = dbConfig .Server
306+ if serverURL == "" {
307+ serverURL = dbConfig .Server
308+ }
309+ if pushKey == "" {
310+ pushKey = dbConfig .PushKey
311+ }
312+ if remotePath == "" {
313+ remotePath = dbConfig .RemotePath
314+ }
306315 }
307316
308317 if remotePath == "" {
@@ -368,6 +377,7 @@ func runPushSync(localPath string, remotePath string) error {
368377 LocalAbsolutePath : absLocalPath ,
369378 InspectionDepth : inspectionDepth ,
370379 SendConfigCmd : needsToBuildDashSQLRSyncFile (localPath , remotePath ),
380+ SetPublic : setPublic ,
371381 })
372382
373383 if err != nil {
@@ -400,7 +410,7 @@ func runPushSync(localPath string, remotePath string) error {
400410
401411 dbConfig .LastPush = time .Now ()
402412 if remoteClient .GetNewPushKey () != "" {
403- fmt .Println ("🔑 This database is now PUSH-enabled." )
413+ fmt .Println ("🔑 This database is now PUSH-enabled on this system ." )
404414 fmt .Println (" A new, replica-specific PUSH key has been stored at ~/.config/sqlrsync/local-secrets.toml" )
405415 dbConfig .ReplicaID = remoteClient .GetReplicaID ()
406416 dbConfig .RemotePath = remoteClient .GetReplicaPath ()
@@ -412,6 +422,11 @@ func runPushSync(localPath string, remotePath string) error {
412422 logger .Warn ("Failed to save local secrets config" , zap .Error (err ))
413423 }
414424
425+ if setPublic {
426+ fmt .Println ("🌐 This replica is now publicly accessible." )
427+ fmt .Println (" Share this database with sqlrsync.com/" + remoteClient .GetReplicaPath ())
428+ }
429+
415430 if needsToBuildDashSQLRSyncFile (localPath , remotePath ) {
416431 token := remoteClient .GetNewPullKey ()
417432 replicaID := remoteClient .GetReplicaID ()
@@ -585,6 +600,7 @@ func init() {
585600 rootCmd .Flags ().StringVar (& replicaID , "replicaID" , "" , "Replica ID for the remote database (overwrites the REMOTE path)" )
586601 rootCmd .Flags ().StringVarP (& serverURL , "server" , "s" , "wss://sqlrsync.com" , "Server URL for push/pull operations" )
587602 rootCmd .Flags ().BoolVarP (& verbose , "verbose" , "v" , false , "Enable verbose logging" )
603+ rootCmd .Flags ().BoolVar (& setPublic , "public" , false , "Enable public access to the replica (only for push operations)" )
588604 rootCmd .Flags ().BoolVar (& newReadToken , "storeNewReadToken" , true , "After syncing, the server creates a new read-only token that is stored in the -sqlrsync file adjacent to the local database" )
589605 rootCmd .Flags ().BoolVar (& dryRun , "dry" , false , "Perform a dry run without making changes" )
590606 rootCmd .Flags ().IntVarP (& timeout , "timeout" , "t" , 8000 , "Connection timeout in milliseconds (Max 10 seconds)" )
0 commit comments