Globals Database Connections with multiple targets

I have a project with 3 databases, one local hosted in docker by Wappler and two in other projects.

I also have 3 targets, one local: Development, and two in remotes: Staging and Production.

When on target Development all my 3 databases run on localhost and everything work in the ‘Database Manager’ and the ‘Server Connect’ panel: I can run changes, see data or apply seed, and each API action querying the databases return data from the correct one.

But when I switch to one of the remote targets, for example Staging only the panel ‘Database Manager’ is updated with the correct configuration. The database handled by Wappler run correctly because the configuration does not change: in target Development it’s hosted in a docker on the network of the web server, and in remote targets too.

The issue is with the two databases that run outside of Wappler. The ‘Database Connections’ object in ‘Globals’ in the ‘Server Connect’ panel is not updated when switching from a target to another.

So when I’m in Development, both connection options in database manager and server connect have the host localhost and when switching to Staging the connection option in database manager is updated to my.custom.host.com for database 2 (for example) and I can access my staging data but in server connect the connection options is still localhost.

Any idea how to handle multiple databases with configuration bound at target level?

When you have different global settings per target, initially they will be the same as your development.

So for one time you have to switch to the different target and edit them to enter the right settings.

From that point on they are saved as target specific settings and will be switched when you switch to that target.

1 Like

I’ve retry from scratch, deleted my remote database (named babel) in database manager and server connect gobals section.

Then I’ve created a new database connection from target dev in database manager but when I switch to target staging the button to configure the connection doesn’t show:

When I edit directly from the files in .wappler/targets/Staging/ (databases and app/modules/connections) the database connection in database manager is good but not in server connect.

EDIT: Refreshing Wappler after switching from another target was necessary for server connect to display the new configuration. Everything seems good for now :smiley:

1 Like