Skip to content

Commit

Permalink
Use .env.local instead of .env (#512)
Browse files Browse the repository at this point in the history
* Use `.env.local` instead of `.env`

* Exclude `.env.local.sample` from gitignore
  • Loading branch information
blakewilson committed Sep 27, 2021
1 parent 7d20a32 commit 5f2349d
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-next-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: copy env
working-directory: e2e-app
run: |
cp .env.sample .env
cp .env.local.sample .env.local
# Generate the schema to ensure no type collisions
- name: Generate Schema
working-directory: e2e-app
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ process.yml
.next
.env
.env.*
!.env.sample
!.env.local.sample
.docusaurus
build/
4 changes: 2 additions & 2 deletions docs/next/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npx create-next-app `
Now, copy the sample environment template:

```bash
cp .env.sample .env
cp .env.local.sample .env.local
```

Finally, run the dev server:
Expand Down Expand Up @@ -65,7 +65,7 @@ The example app above loads WordPress content from the demo site at [https://hea

To point it to a different WordPress site, first, [make sure you have setup the necessary WordPress plugins.](../tutorial/setup-faustjs#installing-plugins-on-wordpress)

Once the necessary plugins have been installed, open the `.env` file you created earlier, it should look something like this:
Once the necessary plugins have been installed, open the `.env.local` file you created earlier, it should look something like this:

```bash
# Your WordPress site URL
Expand Down
2 changes: 1 addition & 1 deletion docs/next/guides/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { headlessConfig } from '@faustjs/core';

if (!process.env.NEXT_PUBLIC_WORDPRESS_URL) {
console.error(
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env file?',
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env.local file?',
);
}

Expand Down
6 changes: 3 additions & 3 deletions docs/next/guides/post-page-previews.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Your headless secret can be found in WP Admin -> Settings -> Headless. Copy this
alt="The Headless WordPress admin interface with a red rectangle around the Secret Key field"
/>

### Add your Headless Secret to your `.env` File
### Add your Headless Secret to your `.env.local` File

Add the `WP_HEADLESS_SECRET` key to your `.env` file with the headless secret as the value. Your `.env` file should already have a value for `NEXT_PUBLIC_WORDPRESS_URL`. The file should look something like this:
Add the `WP_HEADLESS_SECRET` key to your `.env.local` file with the headless secret as the value. Your `.env.local` file should already have a value for `NEXT_PUBLIC_WORDPRESS_URL`. The file should look something like this:

```bash title=.env {13}
```bash title=.env.local {13}
# Your WordPress site URL
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8080

Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/setup-faustjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import { headlessConfig } from '@faustjs/core';

if (!process.env.NEXT_PUBLIC_WORDPRESS_URL) {
console.error(
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env file?',
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env.local file?',
);
}

Expand All @@ -81,9 +81,9 @@ export default headlessConfig({
});
```

### Create `.env`
### Create `.env.local`

You'll also need a `.env` file to hold your environment variables:
You'll also need a `.env.local` file to hold your environment variables:

```bash
# Your WordPress site URL
Expand Down Expand Up @@ -249,7 +249,7 @@ my-app/
_app.tsx
index.tsx
posts.tsx
.env
.env.local
faust.config.js
gqty.config.js
next-env.d.ts
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/next/getting-started/gqty.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('dotenv').config();
require('dotenv-flow').config();

/**
* @type {import("@gqty/cli").GQtyConfig}
Expand Down
2 changes: 1 addition & 1 deletion examples/next/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"devDependencies": {
"@gqty/cli": "^2.0.1",
"@types/react": "^17.0.24",
"dotenv": "^10.0.0",
"dotenv-flow": "3.2.0",
"eslint": "^7.32.0",
"eslint-config-next": "^11.1.2",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/next/getting-started/src/faust.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { headlessConfig } from '@faustjs/core';

if (!process.env.NEXT_PUBLIC_WORDPRESS_URL) {
console.error(
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env file?',
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env.local file?',
);
}

Expand Down
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f2349d

Please sign in to comment.