-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgatsby-config.js
174 lines (167 loc) · 4 KB
/
gatsby-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
require('dotenv').config({
path: `.env.production`,
});
const blogQuery = `{
allMarkdownRemark{
nodes {
frontmatter {
title
date
description
}
fields{
slug
}
excerpt
html
}
}
}`;
const tweetQuery = `{
allTwitterSearchTweetsGatsbyHashtag (limit: 15){
nodes {
full_text
id
retweeted_status{
retweet_count
}
}
}
}`;
const queries = [
{
query: tweetQuery,
transformer: ({data}) => data.allTwitterSearchTweetsGatsbyHashtag.nodes
},
];
const axios = require('axios');
const getAuthorizationToken = () => {
return axios
.post(
"https://stitch.mongodb.com/api/client/v2.0/app/testapp-kcwun/auth/providers/local-userpass/login",
{
username: "notjeffchhen@gmail.com",
password: "blahblah"
},
{
headers: {
"Content-Type": "application/json"
}
}
)
.then(res => `Bearer ${res.data.access_token}`);
};
module.exports = {
siteMetadata: {
title: `Cookbook`,
description: `This is my Cookbook`,
author: `Made by ______`,
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/`,
},
},
{
resolve: "gatsby-source-graphql",
options: {
// Arbitrary name for the remote schema Query type
typeName: "Recipe",
// Field under which the remote schema will be accessible. You'll use this in your Gatsby query
fieldName: "recipe",
// Url to query from
url: "https://us-west-2.aws.stitch.mongodb.com/api/client/v2.0/app/testapp-kcwun/graphql",
headers: async () => {
return {
Authorization: await getAuthorizationToken(),
}
},
refetchInterval: 30,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
`gatsby-remark-relative-images`,
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 750,
linkImagesToOriginal: false,
}
}
]
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-source-twitter`,
options: {
credentials: {
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
bearer_token: process.env.TWITTER_BEARER_TOKEN,
},
queries: {
gatsbyHashtag: {
endpoint: "search/tweets",
params: {
q: "#flattenthecurve",
tweet_mode: "extended",
},
},
},
}
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
{
resolve: `gatsby-plugin-algolia`,
options: {
appId: process.env.GATSBY_ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
queries,
chunkSize: 1000, // default: 1000
},
},
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
/*
{
resolve: `gatsby-plugin-algolia`,
options: {
appId: process.env.GATSBY_ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
indexName: "Blog",
queries,
chunkSize: 10000, // default: 1000
},
},
*/