Replies: 1 comment
-
The common approach is kind of what you describe |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hopefully what I'm trying to accomplish here makes sense. I'm working with a laravel based website, and I'm running into a block trying to figure out the database part of it. I, so far, have been running it locally (my dev machine) for debugging, but now I'm trying to add a database to it. I understand (I think) how to set it up to connect to the RDS database when it's deployed, but when I'm running it locally it doesn't have access to that database so it will crash if I try.
Is there a way to set it so that when I run locally it uses the localhost DB server, and when deployed it uses RDS?
So far the only thing I've come up with is to define an environment variable in the serverless.yml and in the constructor of my database model classes check for that variable and assign it a database connection based on that.
Or have two .env files (.env.local and .env.serverless) and build a deployment script that swaps out the .env based on where it's deploying to?
Beta Was this translation helpful? Give feedback.
All reactions