i am working on a project in nestjs and I am trying to connect to my db but I keep getting no encryption error
This is my Database Provider
export const DataBaseProviders = [
{
provide: REPOSITORY_KEYS.DATA_SOURCE,
useFactory: async (configService: ConfigService) => {
const dataSource = new DataSource({
type: configService.get<DB_TYPE>('DB_TYPE') as DB_TYPE,
host: configService.get<string>('DB_HOST'),
port: configService.get<number>('DB_PORT'),
username: configService.get<string>('DB_USERNAME'),
password: configService.get<string>('DB_PASSWORD'),
database: configService.get<string>('DB_NAME'),
entities: [__dirname + '/../**/*.entity{.ts,.js}'],
synchronize:
configService.get<string>('NODE_ENV') == 'production' ? false : true,
});
return dataSource.initialize();
},
inject: [ConfigService],
},
];
This is the content of my .env
DB_TYPE="--"
DB_HOST="--"
DB_PORT=--
DB_USERNAME="--"
DB_PASSWORD="--"
DB_NAME="--"
This is the error ( Note : I have edited the db credential in the error message like the IP )
[Nest] 12584 – 11/20/2024, 11:37:30 AM ERROR [ExceptionHandler] no pg_hba.conf entry for host “000.00.00.00”, user “admin”, database “mydb”, no encryption
error: no pg_hba.conf entry for host “000.00.00.00”, user “admin”, database “mydb”, no encryption