Open iangregsondev opened 4 years ago
It should be using 192.168.1.20 ip from the config.yaml
The other thing, I am not sure if its correct but on the forRootAsync, the only thing it accepts is a AsyncConsulOptions
static forRoot(options: ConsulOptions): DynamicModule;
static forRootAsync(options: AsyncConsulOptions): DynamicModule;
which only contains "inject", it doesn't contain anything else or inherit from ConsulOptions.
The discoveryHost is your service address, not consul address. This is an config example:
consul:
host: 192.168.1.20
port: 8500
service:
discoveryHost: 127.0.0.1
healthCheck:
timeout: 1s
interval: 10s
maxRetry: 5
retryInterval: 5000
id: null
name: nestcloud-starter-service
port: 8081
Ah damb :-) Thank you. My bad.
@miaowing Could i draw your attention to this ?
In the Service module - there is a forRoot and forRootAsync
static forRoot(options: ServiceOptions): DynamicModule;
static forRootAsync(options?: ServiceOptions): DynamicModule;
I would like to override the discoveryHost, the normal pattern of nestjs forRootAsync is that it takes a method, usually called "useFactory" - where you can inject things and get access to them i.e.
MongooseModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
uri: configService.getString('MONGODB_URI'),
}),
inject: [ConfigService],
});
Not sure what I can do here ? I need to inject my own Class and don't want to depend on the BOOT
Also in the Consule though there is this
static forRoot(options: ConsulOptions): DynamicModule;
static forRootAsync(options: AsyncConsulOptions): DynamicModule;
The forRootAsync only takes in a "inject" nothing else, so I am not able to override anything.
Is this right ? YOu should be able to override it right ?
It's not support useFactory
now, I will add this feature in next version.
Ok - thanks
You can also use the boot module instead of configService
and use NEST_BOOT_PROVIDER
to inject the boot instance.😁
v0.6.x:
import { NEST_BOOT_PROVIDER, IBoot } from '@nestcloud/common';
MongooseModule.forRootAsync({
inject: [NEST_BOOT_PROVIDER],
useFactory: async (boot: IBoot) => ({
uri: boot.get<string>('MONGODB_URI'),
}),
});
v0.7.x:
import { BOOT, IBoot } from '@nestcloud/common';
MongooseModule.forRootAsync({
inject: [BOOT],
useFactory: async (boot: IBoot) => ({
uri: boot.get<string>('MONGODB_URI'),
}),
});
Hi,
I managed to get it bootstraping now, but I have a problem that it's trying to connect to 127.0.0.1 for consul but i have the BootModule loaded with my config.yaml.
It is supposed to pick this up right?
Hey is there a slack or discord service for nestcloud - just for future reference?
Here is a capture of the screen