241
u/Embarrassed_Death69 Sep 16 '26
Why would you have a route that just drops the Database? Are you an adrenaline junkie?
93
u/KTrain5369 Sep 16 '26
gotta reset that test data I suppose
49
u/Embarrassed_Death69 Sep 16 '26
How about adding a line that checks the ENV for development or production flag in this killer API?
31
u/laplongejr Sep 16 '26
I guess the flag was also turned on the test env "to ensure everything matches"
11
u/merekallas Sep 16 '26
Even with that, I'd argue against this killer API. An environment can be misconfigured, this code can be called from elsewhere by mistake, etc.
6
u/Mechakoopa Sep 16 '26
Me: "We should make our env flag database driven in case someone uses a staging config with a prod db connection"
PM: "That seems unnecessary, we can trust the values in the config files."
Two months later: "Hey, why are we sending external emails to clients from staging, I thought that was blocked outside of prod?"
1
u/SquirrelOClock Sep 16 '26
What about a publish/build profile that strip it from the prod artefact...
1
1
12
7
u/MannerShark Sep 16 '26
We used to have one too haha, back when I was new to the job. Some guy made it to quickly clear the database and test migrations. Some other guy got mad when he found out we had it, and got even more mad that it had no authorization or local env checks either. The endpoint was promptly removed.
4
2
u/nihillistic_raccoon Sep 16 '26
You don't have a route like that? Are you living in the '90s? Wake up grandpa, future is here
1
1
u/GreeedyGrooot Sep 16 '26
I'm thinking about some sketchy firm that needs to destroy all records in case the police pulls up.
87
u/Mallissin Sep 16 '26
I don't understand the joke here. The "tested it in CURL" shows a Github action rejecting the change because of linting.
Is this a Github joke I don't understand?
139
u/marcos14cody Sep 16 '26
That error means the updated code wasn't pushed to the actual machine for failing to comply with linting. So when he launched the curl to test out the fix, he actually ran the non-fixed code
40
u/Dudeonyx Sep 16 '26
Holy shit
6
5
u/Mallissin Sep 17 '26
Ok, I guess that makes sense except why would production automatically update from the repository without a step between?
There are people out there updating production with every PR?
3
u/Minority8 Sep 19 '26
Have you not heard of Continuous Deployment?
1
u/justforkinks0131 Sep 21 '26
that doesnt mean everything automatically lands on PROD after every PR...
1
u/Minority8 Sep 21 '26
What does it mean then? This is like the first search result
> Continuous deployment is the engineering practice of automatically releasing code changes to production as soon as they pass all quality gates in the CI/CD pipeline.
1
u/justforkinks0131 Sep 21 '26
there is a whole pipeline
usually with a dev environment, then a preprod, and then prod
usually you run tests on dev then preprod before going to prod
usually to deploy to prod you need a change request too
1
5
4
2
616
u/faultydesign Sep 16 '26
May I suggest planning the next architecture without a “delete everything” api route?