Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit c8cfc02

Browse files
committed
simplify env variables
1 parent f935f45 commit c8cfc02

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ NODE_TLS_REJECT_UNAUTHORIZED="0"
99
# Your WordPress URL.
1010
WORDPRESS_URL="https://nextjs.wpengine.com/"
1111

12-
# This needs to match WORDPRESS_PREVIEW_SECRET constant in wp-config.php. It can be any random string.
12+
# This needs to match the WORDPRESS_PREVIEW_SECRET constant in wp-config.php. It can be any random string of text.
1313
WORDPRESS_PREVIEW_SECRET="ANY_RANDOM_STRING_OF_TEXT"
1414

1515
# Your WordPress username.

api/algolia/connector.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import getEnvVar from '@/functions/getEnvVar'
21
import algoliasearch from 'algoliasearch/lite'
32

43
// Define env vars.
5-
export const algoliaIndexName = getEnvVar('ALGOLIA_INDEX_NAME', true)
4+
export const algoliaIndexName = process.env.NEXT_PUBLIC_ALGOLIA_INDEX_NAME
65
export const algoliaSearchKey = process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_KEY
76
export const algoliaAppId = process.env.NEXT_PUBLIC_ALGOLIA_APPLICATION_ID
87

api/wordpress/connector.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import {ApolloClient, HttpLink, InMemoryCache} from '@apollo/client'
2-
import getEnvVar from '@/functions/getEnvVar'
32
import {initializeApollo} from '../apolloConfig'
43

54
// Define env vars.
6-
export const wpApiUrlBase = getEnvVar('WORDPRESS_API_URL')
5+
export const wpApiUrlBase = process.env.WORDPRESS_URL
76
export const wpPreviewSecret = process.env.WORDPRESS_PREVIEW_SECRET
87
const wpAppUser = process.env.WORDPRESS_APPLICATION_USERNAME
98
const wpAppPass = process.env.WORDPRESS_APPLICATION_PASSWORD

functions/getEnvVar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Retrieve environment-specific var.
2+
* Helper to retrieve environment-specific var.
33
*
44
* @author WebDevStudios
55
* @param {string} varName Environment variable.

0 commit comments

Comments
 (0)