diff --git a/.env b/.env.local similarity index 100% rename from .env rename to .env.local diff --git a/.env.uat b/.env.uat new file mode 100644 index 0000000..b4412a2 --- /dev/null +++ b/.env.uat @@ -0,0 +1,10 @@ +DB_HOST=106.51.105.22 +DB_PORT=5432 +DB_NAME=ar_uat +DB_USER=ar_user +DB_PASSWORD="V$:Q1Hc6Qh]@#Fr" +DB_SYNCHRONIZE=true +DB_SSL=false +PORT=9501 +CORS_ORIGIN=https://aruat.maskantech.in +NODE_ENV=uat diff --git a/README.md b/README.md index 63856de..bed3be5 100644 --- a/README.md +++ b/README.md @@ -18,46 +18,43 @@ This is the backend REST API powered by NestJS. npm install ``` -### Environment files -The project uses environment-specific files: -- .env -- .env.dev -- .env.test +### Environment Files -The npm scripts automatically set NODE_ENV so the correct file is used. +The project uses environment-specific files. The npm scripts automatically set `NODE_ENV` so the correct file is loaded (e.g. `.env.dev`). + +- `.env.local` +- `.env.dev` +- `.env.uat` +- `.env.test` + +### Running the Application + +To start the server, use the command corresponding to your target environment: -### Run locally -Start the local development server: ```bash -npm run start -``` +# Local environment +npm run local +npm run start:local # (watch mode) -Start the development server in watch mode: -```bash +# Development environment npm run dev -``` +npm run start:dev # (watch mode) -### Run tests -Run the test suite with the test environment: -```bash +# UAT environment +npm run uat +npm run start:uat # (watch mode) + +# Test environment npm run test ``` -### Build commands -Build for development: -```bash -npm run build:dev -``` +### Database Seeding -Build for test: -```bash -npm run build:test -``` +To run the master data seed scripts for a specific environment: -### Useful scripts -- npm run start - starts the app using the local development environment -- npm run dev - starts the app using .env.dev -- npm test - runs tests using .env.test -- npm run build - builds the app for development -- npm run build:dev - explicit development build -- npm run build:test - explicit test build +```bash +npm run seed:local +npm run seed:dev +npm run seed:uat +npm run seed:test +``` diff --git a/package.json b/package.json index 9f67bcb..28983cd 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,17 @@ "license": "UNLICENSED", "scripts": { "dev": "cross-env NODE_ENV=dev nest start", - "seed": "cross-env NODE_ENV=dev ts-node -r tsconfig-paths/register scripts/seed-master-data.ts", + "uat": "cross-env NODE_ENV=uat nest start", + "local": "cross-env NODE_ENV=local nest start", + "seed:dev": "cross-env NODE_ENV=dev ts-node -r tsconfig-paths/register scripts/seed-master-data.ts", + "seed:local": "cross-env NODE_ENV=local ts-node -r tsconfig-paths/register scripts/seed-master-data.ts", + "seed:uat": "cross-env NODE_ENV=uat ts-node -r tsconfig-paths/register scripts/seed-master-data.ts", + "seed:test": "cross-env NODE_ENV=test ts-node -r tsconfig-paths/register scripts/seed-master-data.ts", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev": "cross-env NODE_ENV=dev nest start --watch", + "start:uat": "cross-env NODE_ENV=uat nest start --watch", + "start:local": "cross-env NODE_ENV=local nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",