moleculerjs / moleculer-cli

:herb: Command line tool for Moleculer
http://moleculer.services/docs/moleculer-cli.html
MIT License
48 stars 28 forks source link

moleculer connect - transport issue using config #52

Closed ipetrovic11 closed 2 years ago

ipetrovic11 commented 2 years ago

Using moleculer connect --config ./moleculer.config.js transport is not loaded properly.

To verify this after running the command and executing info most of the config is loaded, while the transporter stays TCP

icebob commented 2 years ago

are you sure the path of config file is correct? Could you try to change e.g. namespace in config file and check with info?

ipetrovic11 commented 2 years ago

Yes Screen Shot 2021-11-30 at 10 02 56 PM

And here is the config: Screen Shot 2021-11-30 at 10 03 16 PM

icebob commented 2 years ago

And there is no defined TRANSPORTER env var? Because env var is stronger than config file.

ipetrovic11 commented 2 years ago

100%

icebob commented 2 years ago

Then it's strange, because there is no default transporter, so if it's not defined, transporter won't be created. But in your case, somehow TCP transporter is defined.

ipetrovic11 commented 2 years ago

I am not sure, but using this moleculer connect redis://localhost-staging:30014 --ns=staging works fine.

icebob commented 2 years ago

You are right, there is a strange "if" statement in the code: https://github.com/moleculerjs/moleculer-cli/blob/f246a708b1419c19226a53ca3682bda136286123/src/connect-handler.js#L49-L56

I will fix it.