-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Consolidate connection URL API for adapters #2839
Conversation
|
This also removes the idea of a default database location. Now that we have the |
I seem to remember discussing this a while back, and one of the reasons we have so many Mongo env vars is because of various deployment environments which make them available automatically (netlify might have been one). We were reaching for maximum compatibility there. I'm not concerned that each adapter have the exact same interface - they're going to have to be unique at some point for some options given they're very different databases. I'd prefer to err on the side of making it consistent with the database rather than consistent at the Keystone adapter level. That way a user of keystone can read a random blog or tutorial about Mongo that says "Set your |
The choice of variable name ( |
Am happy to support hose as well, and even set them as the "default". Then accept other options as a "compatibility" layer (which is documented, but a little less obviously). |
Yep, we already support |
We're forward thinking 😉 🤣 |
re: supporting deployment environments, my concern is that it is all a bit magical. If a particular deployment provides the URL as an env var then I think it's not too much to ask the developer to explicitly write |
The original intention was only to ever document More important than the environmental variables though is that it can be configured in different ways, on different adapters - this definitely sucks :) |
Speaking of parity, it's rather odd that the Mongoose adapter accepts Mongoose options directly in the top-level config, whereas the Knex adapter requires an additional |
894993d
to
2eec5e5
Compare
e214ec8
to
584459e
Compare
fe46cc5
to
0f31b01
Compare
942a2af
to
1d93538
Compare
9113565
to
b0d1991
Compare
b829922
to
7dbc518
Compare
b220907
to
24610dc
Compare
24610dc
to
d427f2f
Compare
360d324
to
56fd2ce
Compare
2ae77a6
to
aee4928
Compare
448b857
to
28f28c1
Compare
28f28c1
to
b26c1d6
Compare
b26c1d6
to
15a8bec
Compare
15a8bec
to
f7f1628
Compare
fb92288
to
1fa182b
Compare
d1e9b98
to
ea8dda9
Compare
ea8dda9
to
dde9223
Compare
96052e7
to
eb9aeb5
Compare
eb9aeb5
to
036cc51
Compare
036cc51
to
f361cf5
Compare
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/keystonejs/next-keystone-docs/ehj7uc9ml |
I'm going to close this out as not-going-to-happen. Not enough benefit from the breaking changes it would require. |
The way a developer currently specifies a connection string for their database adapter is either as:
or
Furthermore, for mongo there's a list of ~10 environment variables, and ~3 for knex, which are looked if there isn't an explicit connection string specified.
IMHO this is overly confusing and non-obvious. I would like to propose that both adapters (and any future adapters) allow the dev to specify either:
url
, orDATABASE_URL
.This will simplify the code, but more importantly simplify the docs, so that a user doesn't have to go digging deep through API docs to work out the exact config option to use.
This will obviously be a breaking change, and I'm not keen to push it through too soon on the heals of the Arcade release, but I want to put it out there as an idea.
The code in this PR is a five minute mock up of approximately what the changes would look like. I haven't actually run/tested it, so don't pick on it too hard :-)
Comments welcomed!