-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Usage with environment variables #4288
Copy link
Copy link
Closed
Labels
Description
Issue type:
- question
- bug report
- feature request
- documentation issue
Database system/driver:
-
cordova -
mongodb -
mssql -
mysql/mariadb -
oracle -
postgres -
cockroachdb -
sqlite -
sqljs -
react-native -
expo
TypeORM version:
-
latest -
@next -
0.x.x(or put your version here)
Steps to reproduce or a small repository showing the problem:
I'm currently trying to configure TypeORM by passing a config object into the constructor from my config service.
@Module({
imports: [
ConfigModule,
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (
config: ConfigService
): Promise<TypeOrmModuleOptions> => (config.dbOptions),
inject: [ConfigService],
}),
],
providers: [
ConfigService,
],
})This works fine, but the problem is that I can't find a way to have TypeORM use this configuration to run migrations...it seems to expect an ormconfig.json file on disk...which isn't there because my config is coming in via ConfigService. This means that I can't currently run my migrations because typeorm can't find my ormconfig.json file.
How do I tell TypeORM to use the configuration values provided to the constructor?
Reactions are currently unavailable