moleculerjs / moleculer-channels

Reliable messages for Moleculer services via external queue/channel/topic.
MIT License
72 stars 15 forks source link

move channel to root of config's object? #36

Closed 0x0a0d closed 2 years ago

0x0a0d commented 2 years ago

I think channel can be defined in moleculer.config.js likes this

module.export = {
// ...
channel: {
  redis: {
    // config
  },
//  more : {},
},
//...
}

because current way to use channel middleware, made it can not

overwrite broker’s deeply nested default options, which are not present in moleculer.config.js, via environment variables https://moleculer.services/docs/0.14/runner.html#Configuration-loading-logic

icebob commented 2 years ago

I don't agree with it. The moleculer-channel is a middleware, and moleculer.config contains settings for ServiceBroker and internal modules only.

You can use env vars this way:

module.exports = {
    logger: true,

    middlewares: [
        ChannelsMiddleware({
            adapter: process.env.CHANNELS_ADAPTER_URL
        })
    ]
};