Skip to content

Commit 54dd4ae

Browse files
committed
Set up ghost in config
1 parent 5eaffc7 commit 54dd4ae

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.cache
33
public
4-
.DS_Store
4+
.DS_Store
5+
.env

gatsby-config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ const config = require(`./src/utils/siteConfig`);
99
* Further info 👉🏼 https://www.gatsbyjs.org/docs/gatsby-config/
1010
*
1111
*/
12+
let ghostConfig;
13+
14+
try {
15+
ghostConfig = require(`./.ghost`);
16+
} catch (e) {
17+
ghostConfig = {
18+
production: {
19+
apiUrl: process.env.GHOST_API_URL,
20+
contentApiKey: process.env.GHOST_CONTENT_API_KEY,
21+
},
22+
development: {
23+
apiUrl: process.env.GHOST_API_URL,
24+
contentApiKey: process.env.GHOST_CONTENT_API_KEY,
25+
},
26+
};
27+
}
28+
1229
module.exports = {
1330
pathPrefix: "/",
1431
siteMetadata: {
@@ -22,6 +39,13 @@ module.exports = {
2239
// PRESERVE_FILE_DOWNLOAD_CACHE: true,
2340
},
2441
plugins: [
42+
{
43+
resolve: `gatsby-source-ghost`,
44+
options:
45+
process.env.NODE_ENV === `development`
46+
? ghostConfig.development
47+
: ghostConfig.production,
48+
},
2549
{
2650
resolve: `gatsby-plugin-google-gtag`,
2751
options: {

0 commit comments

Comments
 (0)