Skip to content

Commit

Permalink
bug: process.env
Browse files Browse the repository at this point in the history
gatsbyjs/gatsby#3896
process.env was returning undefined
added a config object into require(dotenv) w/ path: env.process.env.NODE_ENV
  • Loading branch information
MrT3313 committed Dec 10, 2019
1 parent 582c8e0 commit dd707e1
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 159 deletions.
51 changes: 26 additions & 25 deletions client/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
// configure options for a Gatsby site, with metadata for project title, description, plugins, etc.

// -- //
require('dotenv').config()

require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`
});

console.log(process.env)
console.log('Space ID:',process.env.CONTENTFUL_SPACE_ID)
console.log('Access Token:',process.env.CONTENTFUL_ACCESS_TOKEN)

console.log('Space ID:',process.env.CONTENTFUL_spaceID)
console.log('Access Token:',process.env.CONTENTFUL_accessToken)
module.exports = {

// METADATA
siteMetadata: {
// title: `Gatsby Default Starter`,
title: `NoteCards`,
subTitle: `The Proving Ground`,
description: `Description`,
author: `Reed Turgeon`,
},

// PLUGINS
plugins: [
// ACCESS: Markdown Data Plugin
// - 1 - // ACCESS: Markdown Data Plugin
{
resolve: `gatsby-source-filesystem`,
options: {
name: 'src',
path: `${__dirname}/src/`
}
},

// TRANSFORM: Markdown File into usefull html
// - 1.1 - // TRANSFORM: Markdown File into usefull html
`gatsby-transformer-remark`,

// SASS Plugin
`gatsby-plugin-sass`,

// Images
// `gatsby-plugin-sharp`,
// `gatsby-transformer-sharp`,

// - 2 - // Contentful CMS Plugin
{
resolve: `gatsby-source-contentful`,
options: {
// Learn about environment variables: https://gatsby.dev/env-vars

// spaceId: process.env.CONTENTFUL_SPACE_ID,
spaceId: 'dr9akv6vk3ki',

// accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
accessToken: 'wagOJCJBBQCL7W2km6YGHl8Sph1UkVdr490kY3VXed8',
spaceId: process.env.CONTENTFUL_spaceID,
accessToken: process.env.CONTENTFUL_accessToken,
},
},

// - 3 - // SASS Plugin
`gatsby-plugin-sass`,

// - 4 - // Protecting HTML requests
`gatsby-plugin-react-helmet`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `images`,
// path: `${__dirname}/src/images`,
// },
// },


// Images
// `gatsby-plugin-sharp`,
// `gatsby-transformer-sharp`,

// {
// resolve: `gatsby-plugin-manifest`,
// options: {
Expand Down
1 change: 1 addition & 0 deletions client/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ./gatsby-node.js

// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
exports.onCreatePage = async ({ page, actions }) => {
Expand Down
Loading

0 comments on commit dd707e1

Please sign in to comment.