17 lines
460 B
TypeScript
Executable File
17 lines
460 B
TypeScript
Executable File
import type { HttpModuleAsyncOptions } from '@nestjs/axios';
|
|
import { ConfigService } from '@nestjs/config';
|
|
|
|
export function httpConfig(): HttpModuleAsyncOptions {
|
|
return {
|
|
inject: [ConfigService],
|
|
global: true,
|
|
useFactory: (configService: ConfigService) => {
|
|
return {
|
|
timeout: configService.getOrThrow<number>('AXIOS_TIMEOUT'),
|
|
headers: { 'Content-Type': 'application/json' },
|
|
global: true,
|
|
};
|
|
},
|
|
};
|
|
}
|