chore: add new service to add subs to danak services in array

This commit is contained in:
mahyargdz
2025-02-13 13:27:21 +03:30
parent 95b9c38031
commit caa968ab4a
24 changed files with 317 additions and 98 deletions
+15
View File
@@ -0,0 +1,15 @@
import { HttpModuleAsyncOptions } from "@nestjs/axios";
import { ConfigService } from "@nestjs/config";
export function httpConfig(): HttpModuleAsyncOptions {
return {
inject: [ConfigService],
useFactory: async (configService: ConfigService) => {
return {
timeout: configService.getOrThrow<number>("AXIOS_TIMEOUT"),
headers: { "Content-Type": "application/json" },
global: true,
};
},
};
}
+6 -6
View File
@@ -7,20 +7,20 @@ export function mailerConfig(): MailerAsyncOptions {
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
transport: {
host: configService.get("SMTP_HOST"),
port: configService.get("SMTP_PORT"),
host: configService.getOrThrow<string>("SMTP_HOST"),
port: configService.getOrThrow<number>("SMTP_PORT"),
secure: false,
auth: {
user: configService.get("SMTP_USER"),
pass: configService.get("SMTP_PASS"),
user: configService.getOrThrow<string>("SMTP_USER"),
pass: configService.getOrThrow<string>("SMTP_PASS"),
},
},
defaults: {
from: configService.get("MAIL_FROM"),
from: configService.getOrThrow<string>("MAIL_FROM"),
},
template: {
dir: __dirname + "/templates",
dir: process.cwd() + "/templates",
adapter: new HandlebarsAdapter(),
options: {
strict: true,
+3 -11
View File
@@ -7,24 +7,16 @@ export function smsConfigs() {
return {
API_URL: configService.getOrThrow<string>("SMS_API_URL"),
API_KEY: configService.getOrThrow<string>("SMS_API_KEY"),
SECRET_KEY: configService.getOrThrow<string>("SMS_SECRET"),
// SECRET_KEY: configService.getOrThrow<string>("SMS_SECRET"),
SMS_PATTERN_OTP: configService.getOrThrow<string>("SMS_PATTERN_OTP"),
// SMS_SECRET_BODY: {
// UserApiKey: configService.getOrThrow<string>("SMS_API_KEY"),
// SecretKey: configService.getOrThrow<string>("SECRET_KEY"),
// },
};
},
};
}
export interface ISmsConfigs {
URL: string;
API_URL: string;
API_KEY: string;
SECRET_KEY: string;
// SECRET_KEY: string;
SMS_PATTERN_OTP: string;
SMS_SECRET_BODY: {
UserApiKey: string;
SecretKey: string;
};
}