Skip to content

Multi environment support #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ GOOGLE_CLIENT_SECRET=''
GOOGLE_REDIRECT_URI = ''

# DATABSES
DATABASE_URL=""
REDIS_URL=""
REDIS_URL=""
MONGO_DATABASE_URL=""
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ web_modules/

# dotenv environment variable files
.env
.env.development
.env.development.local
.env.test.local
.env.production
.env.production.local
.env.local

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ Before you get started, make sure you have the following installed on your machi
```sh
docker compose up -d
```

2. **Install Dependencies**:

- Use pnpm to install all the necessary dependencies:
```sh
pnpm i
```

3. **Configure Environment Variables**:

- Create a `.env` file in the root directory.
- Use the provided `.env.sample` as a template to enter all the required environment variables.
- Create `.env.development` and `.env.production` files in the root directory.
- Use the provided `.env.sample` as a template to set up the environment variables in these files.

## What's Included
Comment on lines -35 to 38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Consider explaining the reason for separate development and production environment files.

While separating environments is a good practice, a brief explanation of why you're using two files now might help users understand the change better.

Suggested change
- Create a `.env` file in the root directory.
- Use the provided `.env.sample` as a template to enter all the required environment variables.
- Create `.env.development` and `.env.production` files in the root directory.
- Use the provided `.env.sample` as a template to set up the environment variables in these files.
## What's Included
- Create `.env.development` and `.env.production` files in the root directory:
- `.env.development` for local development settings
- `.env.production` for production environment settings
- This separation allows for different configurations based on the environment
- Use the provided `.env.sample` as a template to set up the environment variables in these files


Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "dist/main.js",
"scripts": {
"dev": "dotenv -e .env -- ts-node-dev --transpile-only ./src/main.ts",
"dev": "dotenvx run -f .env.development -- ts-node-dev --transpile-only ./src/main.ts",
"prod": "dotenvx run -f .env.production -- ts-node-dev --transpile-only ./src/main.ts",
"seeder": "ts-node --transpile-only ./src/seeder.ts",
"build": "tsup --config build.ts",
"start:prod": "dotenv -e .env -- node ./dist/main.js",
Expand Down Expand Up @@ -55,6 +56,7 @@
"@aws-sdk/client-s3": "^3.606.0",
"@bull-board/api": "^5.19.0",
"@bull-board/express": "^5.16.0",
"@dotenvx/dotenvx": "^1.14.0",
"@prisma/client": "^5.13.0",
"@types/compression": "^1.7.2",
"argon2": "^0.30.3",
Expand Down
Loading