import { inject , lifeCycleObserver , LifeCycleObserver } from '@loopback/core' ; import { juggler } from '@loopback/repository' ; const config = { name : 'chatDb' , connector : 'postgresql' , url : '' , host : process . env . CHAT_DB_HOST , port : process . env . CHAT_DB_PORT , user : process . env . CHAT_DB_USER , password : process . env . CHAT_DB_PASSWORD , database : process . env . CHAT_DB_DATABASE , schema : process . env . CHAT_DB_SCHEMA , } ; @ lifeCycleObserver ( 'datasource' ) export class ChatDbDataSource extends juggler . DataSource implements LifeCycleObserver { static dataSourceName = 'chatDb' ; static readonly defaultConfig = config ; constructor ( @ inject ( 'datasources.config.chatDb' , { optional : true } ) dsConfig = config ) { super ( dsConfig ) ; } }