Skip to content

Commit

Permalink
change key name in setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
msweeneydev committed Jan 27, 2020
1 parent 5beb700 commit 171a5bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/with-graphql-faunadb/scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ const readline = require('readline').createInterface({
output: process.stdout,
})

// In order to set up a database, we need a server key, so let's ask the user for a key.
readline.question(`Please provide the FaunaDB server key\n`, serverKey => {
// In order to set up a database, we need an admin key, so let's ask the user for a key.
readline.question(`Please provide the FaunaDB admin key\n`, adminKey => {
// A graphql schema can be imported in override or merge mode: 'https://docs.fauna.com/fauna/current/api/graphql/endpoints#import'
const options = {
model: 'merge',
uri: 'https://graphql.fauna.com/import',
headers: { Authorization: `Bearer ${serverKey}` },
headers: { Authorization: `Bearer ${adminKey}` },
}
const stream = fs.createReadStream('./schema.gql').pipe(request.post(options))

Expand All @@ -44,7 +44,7 @@ readline.question(`Please provide the FaunaDB server key\n`, serverKey => {
.then(res => {
// The GraphQL schema is important, this means that we now have a GuestbookEntry Colleciton and an entries index.
// Then we create a token that can only read and write to that index and collection
var client = new faunadb.Client({ secret: serverKey })
var client = new faunadb.Client({ secret: adminKey })
return client
.query(
q.CreateRole({
Expand Down Expand Up @@ -81,7 +81,7 @@ readline.question(`Please provide the FaunaDB server key\n`, serverKey => {
.then(res => {
// The GraphQL schema is important, this means that we now have a GuestbookEntry Colleciton and an entries index.
// Then we create a token that can only read and write to that index and collection
var client = new faunadb.Client({ secret: serverKey })
var client = new faunadb.Client({ secret: adminKey })
return client
.query(
q.CreateKey({
Expand Down

0 comments on commit 171a5bf

Please sign in to comment.