Skip to content
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

feat(connection): bring your own DB connection #458

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

goldcaddy77
Copy link
Owner

No description provided.

@@ -34,6 +31,7 @@ export interface ServerOptions<T> {
apolloConfig?: ApolloServerExpressConfig;
authChecker?: AuthChecker<T>;
autoGenerateFiles?: boolean;
connectionGetter?: (config: Config) => Connection | Promise<Connection>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer this to either be a drop in Connection or for the input parameter to this function type be typeorm's ConnectionOptions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
connectionGetter?: (config: Config) => Connection | Promise<Connection>;
connectionGetter?: (options: ConnectionOptions) => Connection | Promise<Connection>;
Suggested change
connectionGetter?: (config: Config) => Connection | Promise<Connection>;
connection?: Connection;

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection - in this case, there would be no way to reconnect in the case the server drops the DB connection, right? Is that ok?
ConnectionOptions - Server already allows you to pass ConnectionOptions: https://github.com/goldcaddy77/warthog/pull/458/files#R67 . Could you just use that? I figured you needed access to the raw connection to be able to mutate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants