🚀 release v3.0.0

This commit is contained in:
Amruth Pillai
2022-03-06 22:48:29 +01:00
parent 00505a9e5d
commit 9c1380f401
373 changed files with 12050 additions and 15783 deletions

View 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',
}));

View 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),
}));

View 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 {}

View 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,
}));

View 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,
}));

View 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,
}));