[Bug]: the async configuration example given in nestjs-module emits an error #215
Closed
Description
Bug Report
Current behavior
The following sample code
@Module({
imports: [
OgmaModule.forRootAsync({
useFactory: (config: ConfigService) => ({
service: {
json: config.isProd(),
stream: {
write: (message) =>
appendFile(config.getLogFile(), message, (err) => {
if (err) {
throw err;
}
})
},
application: config.getAppName()
},
interceptor: {
http: ExpressParser,
ws: false,
gql: false,
rpc: false
}
}),
inject: [ConfigService]
})
]
})
Throws the following error:
- write(message) should return a boolean
Expected behavior
The example should work flawlessly
Possible Solution
To fix the errors I had to do the following:
@Module({
imports: [
OgmaModule.forRootAsync({
useFactory: (config: ConfigService) => ({
service: {
json: config.isProd(),
stream: {
write: (message: string): boolean => {
appendFile(config.getLogFile(), message, (err) => {
if (err) {
throw err;
}
})
return true
}
},
application: config.getAppName()
},
interceptor: {
http: ExpressParser,
ws: false,
gql: false,
rpc: false
}
}),
inject: [ConfigService]
})
]
})
Environment
@ogma/nestjs-module": "^0.3.0"
@ogma/platform-express": "^0.3.0
For Tooling issues:
- Node version: v12.11.1
- Platform: Linux xps 5.0.0-1068-oem-osp1 #73-Ubuntu
Others:
using npm
Metadata
Assignees
Labels
No labels