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(forRoot): Allow connection name as entry param #1030

Closed

Conversation

LeoAnesi
Copy link
Contributor

@LeoAnesi LeoAnesi commented Oct 9, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

Issue Number: #66

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

  • This PR is dependent of PR 1029 that fixes eslint
  • It works if you specify in every entity what connection you are using, but does not allow to use one named connection as you would do with an unnamed one, which is what I would need for example to change the database used depending if I'm running tests or dev server. I'm not sure it closes the issue
  • If you have any idea to improve this / to make what I said above work I would be happy to take them into account
  • As I'm not certain it brings value to this repo I'm waiting for a validation to write the corresponding doc

@LeoAnesi LeoAnesi changed the title chore(eslint): fix errors feat(forRoot): Allow connection name as entry param Oct 9, 2021
@LeoAnesi LeoAnesi force-pushed the feat/foorRoot-allow-connection-name branch from 3570590 to 0823325 Compare December 27, 2021 08:48
@LeoAnesi LeoAnesi force-pushed the feat/foorRoot-allow-connection-name branch from 0823325 to f305b7a Compare December 27, 2021 09:40
@LeoAnesi
Copy link
Contributor Author

This implies a lot of changes in the code that are not easy and the doc already answers this issue with this suggestion :

TypeOrmModule.forRootAsync({
  useFactory: async () =>
    Object.assign(await getConnectionOptions(), {
      autoLoadEntities: true,
    }),
});

In that case we just have to give a name to getConnectionOptions and it will work

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.

1 participant