Skip to content

Commit

Permalink
Improved default gitignore regarding .env rules. (#2083)
Browse files Browse the repository at this point in the history
* Improved default gitignore regarding .env rules.

* Update web/docs/project/env-vars.md

Co-authored-by: Mihovil Ilakovac <[email protected]>

* Uncommented dotenv info in docs.

* Updated gitignores of example apps.

* Added to ChangeLog.

---------

Co-authored-by: Mihovil Ilakovac <[email protected]>
  • Loading branch information
Martinsos and infomiho authored Jun 7, 2024
1 parent 5bb5159 commit 3679ab6
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 124 deletions.
20 changes: 9 additions & 11 deletions examples/hackathon-submissions/.gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
/.wasp/
/.env.server
/.env.client
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example

# Local Netlify folder
.netlify
16 changes: 8 additions & 8 deletions examples/streaming/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
16 changes: 8 additions & 8 deletions examples/thoughts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
17 changes: 9 additions & 8 deletions examples/todo-typescript/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example

17 changes: 9 additions & 8 deletions examples/tutorials/TodoApp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example

16 changes: 8 additions & 8 deletions examples/tutorials/TodoAppTs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
19 changes: 8 additions & 11 deletions examples/waspello/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
/.wasp/
/.env.server
/.env.client
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
20 changes: 8 additions & 12 deletions examples/waspleau/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
/.wasp/
/.env.server
/.env.client
.DS_Store
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
16 changes: 8 additions & 8 deletions examples/websockets-realtime-voting/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
1 change: 1 addition & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ These changes only apply to getting auth fields from the `user` object you recei
- Improved the default loading spinner while waiting for the user to be fetched.
- Hides Prisma update message to avoid confusion since users shouldn't update Prisma by themselves.
- When an unknown OAuth error happens, Wasp now logs the error on the server to help with debugging.
- Improved default gitignore to more tightly target dotenv files and to allow for example dotenv files and .env.client.

## 0.13.2 (2024-04-11)

Expand Down
16 changes: 8 additions & 8 deletions waspc/data/Cli/templates/skeleton/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
19 changes: 8 additions & 11 deletions waspc/examples/crud-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
/.wasp/
/.env.server
/.env.client
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
17 changes: 8 additions & 9 deletions waspc/examples/pg-vector-example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
/.wasp/
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
16 changes: 8 additions & 8 deletions waspc/examples/todo-typescript/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.wasp/
node_modules/
**/.DS_Store

# We ignore env files recognized and used by Wasp.
.env.server
.env.client

# To be extra safe, we by default ignore any files with `.env` extension in them.
# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
*.env
*.env.*
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
17 changes: 13 additions & 4 deletions waspc/examples/todoApp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/.wasp/
/.env.server
/.env.client
/node_modules
.wasp/
node_modules/

# We by default ignore any dotenv files to avoid committing any secrets by accident.
# If this is too agressive for you, consider allowing specific files with `!` operator,
# or modify/delete these two lines.
.env
.env.*
# Don't ignore .env.client as it can't contain any secrets.
!.env.client
# Don't ignore example env files.
!.env.example
!.env.*.example
7 changes: 5 additions & 2 deletions web/docs/project/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ In the root of your Wasp project you can create two distinct files:
REACT_APP_SOME_VAR_NAME=somevalue
```
These files should not be committed to version control, and they are already ignored by default in the `.gitignore` file that comes with Wasp.
`.env.server` should not be committed to version control as it can contain secrets and is therefore by default already ignored in the `.gitignore` file that comes with a new Wasp app.
On the other hand, `.env.client` can be committed as it must not contain any secrets.
<!-- `dotenv` files are a popular method for storing configuration: to learn more about them in general, check out the [README of the lib we use for them](https://github.com/stackbuilders/dotenv-hs). -->
:::info Dotenv files
`dotenv` files are a popular method for storing configuration: to learn more about them in general, check out the [dotenv npm package](https://www.npmjs.com/package/dotenv).
:::
### 2. Using Shell
If you set environment variables in the shell where you run your Wasp commands (e.g., `wasp start`), Wasp will recognize them.
Expand Down

0 comments on commit 3679ab6

Please sign in to comment.