chore: sms service with configs

This commit is contained in:
matin jamshidi
2025-01-19 14:46:16 +03:30
parent b899b8df6f
commit a934e5b55e
8 changed files with 132 additions and 4 deletions
+30
View File
@@ -0,0 +1,30 @@
import { ConfigService } from "@nestjs/config";
export function SmsConfigs() {
return {
inject: [ConfigService],
useFactory(configService: ConfigService) {
return {
URL: configService.getOrThrow<string>("URL"),
API_KEY: configService.getOrThrow<string>("API_KEY"),
SECRET_KEY: configService.getOrThrow<string>("SECRET_KEY"),
SMS_PATTERN_OTP: configService.getOrThrow<string>("SMS_PATTERN_OTP"),
SMS_SECRET_BODY: {
UserApiKey: configService.getOrThrow<string>("API_KEY"),
SecretKey: configService.getOrThrow<string>("SECRET_KEY"),
},
};
},
};
}
export interface ISmsConfigs {
URL: string;
API_KEY: string;
SECRET_KEY: string;
SMS_PATTERN_OTP: string;
SMS_SECRET_BODY: {
UserApiKey: string;
SecretKey: string;
};
}