mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-18 10:41:56 +10:00
🚀 release v3.0.0
This commit is contained in:
10
server/src/config/app.config.ts
Normal file
10
server/src/config/app.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('app', () => ({
|
||||
timezone: process.env.TZ,
|
||||
environment: process.env.NODE_ENV,
|
||||
secretKey: process.env.SECRET_KEY,
|
||||
port: parseInt(process.env.SERVER_PORT, 10) || 3100,
|
||||
url: process.env.APP_URL || 'http://localhost:3000',
|
||||
serverUrl: process.env.SERVER_URL || 'http://localhost:3100',
|
||||
}));
|
||||
6
server/src/config/auth.config.ts
Normal file
6
server/src/config/auth.config.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('auth', () => ({
|
||||
jwtSecret: process.env.JWT_SECRET,
|
||||
jwtExpiryTime: parseInt(process.env.JWT_EXPIRY_TIME, 10),
|
||||
}));
|
||||
52
server/src/config/config.module.ts
Normal file
52
server/src/config/config.module.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule as NestConfigModule } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import appConfig from './app.config';
|
||||
import authConfig from './auth.config';
|
||||
import databaseConfig from './database.config';
|
||||
import googleConfig from './google.config';
|
||||
import mailConfig from './mail.config';
|
||||
|
||||
const validationSchema = Joi.object({
|
||||
// App
|
||||
TZ: Joi.string().default('UTC'),
|
||||
PORT: Joi.number().default(3100),
|
||||
SECRET_KEY: Joi.string().required(),
|
||||
NODE_ENV: Joi.string().valid('development', 'production').default('development'),
|
||||
|
||||
// URLs
|
||||
APP_URL: Joi.string().default('http://localhost:3000'),
|
||||
SERVER_URL: Joi.string().default('http://localhost:3100'),
|
||||
|
||||
// Database
|
||||
POSTGRES_HOST: Joi.string().required(),
|
||||
POSTGRES_PORT: Joi.number().default(5432),
|
||||
POSTGRES_USERNAME: Joi.string().required(),
|
||||
POSTGRES_PASSWORD: Joi.string().required(),
|
||||
POSTGRES_DATABASE: Joi.string().required(),
|
||||
POSTGRES_SSL_CERT: Joi.string().allow(''),
|
||||
|
||||
// Auth
|
||||
JWT_SECRET: Joi.string().required(),
|
||||
JWT_EXPIRY_TIME: Joi.number().required(),
|
||||
|
||||
// Google
|
||||
GOOGLE_API_KEY: Joi.string().allow(''),
|
||||
|
||||
// Mail
|
||||
MAIL_HOST: Joi.string().allow(''),
|
||||
MAIL_PORT: Joi.number().default(465),
|
||||
MAIL_USERNAME: Joi.string().allow(''),
|
||||
MAIL_PASSWORD: Joi.string().allow(''),
|
||||
});
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
NestConfigModule.forRoot({
|
||||
load: [appConfig, authConfig, databaseConfig, googleConfig, mailConfig],
|
||||
validationSchema: validationSchema,
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class ConfigModule {}
|
||||
10
server/src/config/database.config.ts
Normal file
10
server/src/config/database.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('postgres', () => ({
|
||||
host: process.env.POSTGRES_HOST,
|
||||
port: parseInt(process.env.POSTGRES_PORT, 10) || 5432,
|
||||
username: process.env.POSTGRES_USERNAME,
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
database: process.env.POSTGRES_DATABASE,
|
||||
certificate: process.env.POSTGRES_SSL_CERT,
|
||||
}));
|
||||
7
server/src/config/google.config.ts
Normal file
7
server/src/config/google.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('google', () => ({
|
||||
apiKey: process.env.GOOGLE_API_KEY,
|
||||
clientId: process.env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
||||
}));
|
||||
9
server/src/config/mail.config.ts
Normal file
9
server/src/config/mail.config.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('mail', () => ({
|
||||
host: process.env.MAIL_HOST,
|
||||
port: parseInt(process.env.MAIL_PORT, 10) || 465,
|
||||
username: process.env.MAIL_USERNAME,
|
||||
password: process.env.MAIL_PASSWORD,
|
||||
from: process.env.MAIL_FROM,
|
||||
}));
|
||||
Reference in New Issue
Block a user