微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

动态模块中的 YML 文件

如何解决动态模块中的 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 举报,一经查实,本站将立刻删除。