Alternative Database Connection

I would like to have the ability to build under a “dev area” & “production area” I know i can create extra targets for this but when it comes to dynamic data via appconnect / server connect I can only have 1 database solution…

I would like to know if there is a method currently or on the future features list to specify the database based on the target of the files and/or url of the session…

I really don’t want to have to build 2 front-ends and 2 back-ends and then use GIT to move files from one environment to another…

Indeed that is why we have the targets. You can have a dev target and live target.
You can have the connections named exactly the same.

Currently when you edit the connections those get directly uploaded to the current target. So that makes editing a bit difficult. I think we should improve that by keeping separate connections per target also locally. So when you edit the connection you edit it only for the current target.

When switching targets the connection then should auto switch.

Will that fits your workflow?

4 Likes

I will have to test that option out, will have to see.

Yes, that would be perfect. Any idea when this will be implemented? How do I set up the connections in the meantime?

Sorry, I’ve also just posted in another thread but feel this thread may be more relevant.

2 posts were split to a new topic: Different base /site structure for local dev and live site

I’ve been working on a project locally and am now wanting to put it onto a live server. I’ve set up the new target (FTPS Explicit) and it’s uploaded all the files perfectly.

However, how do I set the database connection details for the live site? I’m using PHP/MySQL.

I was assuming the target would have the connection details so as I switch between localhost and live, the right connections are used. This thread indicates that’s your aim, too, but I can’t find where to set it.

Thanks @nshkrsh but this isn’t a viable long-term solution. I can’t keep changing the connection settings every time I switch between dev and live.

You should not switch frequently between live & dev. The point of having a dev version is to iron-out all the issues, then change connection once and publish to live.
That’s my view & how I use it.
Although it would be better if Wappler natively supported this in some way, but for now, this works.

If you have some solution on how this should work, please do create a new feature request topic.

1 Like

Unfortunately projects are always being updated. It’s never a case of develop locally until it’s 100% complete, then publish to live and leave it alone.

You’re not getting my point. You do not update live directly. You work on dev and finalize updates to push. So you publish to live only once per update cycle. So changing DB connection has to be done once per live push - if its daily, change it once daily.
That’s not so bad until an actual solution comes up.

I agree with this. It might be a matter of making a small change to a page or adding a new feature affecting several pages etc., but probably never uploading a whole site.

Having said that, I’m not quite clear what the problem is - or if there need be a problem. My local and remote databases and connections are identical, and no changes are needed when switching between the two.

1 Like

I disagree. You always work locally and you frequently push to live when it’s tested and working. This could be every day, even multiple times a day. If you have to make changes to connections and base paths every time, that’s going to be a problem.

In the old days with Dreamweaver, the connection details were in a single script. Once that was configured on the live site, it was left alone. Everything else could be uploaded as often as you want and never needed to be different to the local version.

1 Like

If I’d known about this issue then I would have configured my local environment to match the live one. But I didn’t so now I’ve got to go through it all.

Wappler is a stunning piece of software and the improvements every week are awesome but I do feel this is a significant issue which needs to be resolved.

Any idea when this will be implemented?

It is key to have this to properly manage multiple environments.

Maybe it’s easier if the connection could take environment variables (specific to each environment), so the connection would be the same, just the value of the variables would differ.

Regards.

2 Likes

Hi, agreed that this is a well needed feature to have a proper deployment process from development to production particularly for live applications.

In the meantime, if you use git for deployment, you can remove the files in dmxConnect/modules/Connections folder from the repository and manually deploy them with their server specific information. Once this is initially setup, you don’t have to think about it again, unless the credentials change.

1 Like

I’m really, really keen for the feature to be added where you set the database connection details per target. For now, I’m publishing to a live server and not having a local copy but I’d rather be able to work locally and then publish to the live server when it’s ready.

1 Like

Been waiting over a year for this feature guys, Workarounds are ok as a temporarily measure but surely this should’ve been implemented by now @George

We need to have a local development target and a live target with their own database connection settings or indeed be able to develop with docker local then Publish files to a non docker enabled server without changing database connection settings every time.

5 Likes

This has been Implemented in Wappler 2.7.0

3 Likes