动态模块中的 YML 文件

问题描述

是否可以在动态模块中添加 YML 文件,因为我可以从 .env 文件添加。我添加 yml 文件的方式是使用自定义配置文件https://docs.nestjs.com/techniques/configuration#custom-configuration-files

  imports: [
    ConfigModule.forRoot({ 
      isGlobal: true,//ignoreEnvFile: true,load: [configuration]
    }),Neo4jModule.forRootAsync({
      imports: [ ConfigModule ],inject: [ ConfigService ],useFactory: (configService: ConfigService): Neo4jConfig => {
        console.log(configService.get('NEO4J_SCHEME'))
        console.log(configService.get('db.neo4j.host')) // undefined
        return {
          scheme: configService.get('NEO4J_SCHEME'),host: 'localhost',//configService.get('NEO4J_HOST'),port: 7687,//configService.get('NEO4J_PORT'),username: 'xxxx',//configService.get('NEO4J_USERNAME'),password: 'xxxxx',//configService.get('NEO4J_PASSWORD'),database: 'xxxxx'//configService.get('NEO4J_DATABASE'),}
      }
    }),UserModule
  ],controllers: [AppController],providers: [AppService],})
export class AppModule {}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)