You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
It's possible to change the database name based on context?
I want to change the database name based in the request headers, it will be nice to do something like this:
import{ArangoDBAdapter}from"cruddl";import{ApolloServer}from"apollo-server";constschema=project.createSchema(db);db.updateSchema(project.getModel());// create missing collectionsconstdb=newArangoDBAdapter({databaseName: "databaseName",url: "http://root:@localhost:8529",user: "root",password: ""});constserver=newApolloServer({
schema,context: ({ req })=>{const{tenantId}=jwt.verify(req.headers.authorization);db.setDatabseName(tenantId);returnreq;}});server.listen(4000,()=>console.log("Server is running on http://localhost:4000/"));
It very useful for build multi tenant system with database isolation.
The text was updated successfully, but these errors were encountered:
Hello.
It's possible to change the database name based on context?
I want to change the database name based in the request headers, it will be nice to do something like this:
It very useful for build multi tenant system with database isolation.
The text was updated successfully, but these errors were encountered: