update readme

This commit is contained in:
DavidWells 2018-06-20 20:49:20 -07:00
parent 41f5090e2c
commit 2a30a7164b
3 changed files with 20 additions and 10 deletions

View file

@ -1,6 +1,6 @@
# Netlify + FaunaDB # Netlify + FaunaDB
Example of using FaunaDB with [netlify functions](https://www.netlify.com/docs/functions/) Example of using FaunaDB with [Netlify functions](https://www.netlify.com/docs/functions/)
Deploy this app with one-click via this link: Deploy this app with one-click via this link:
@ -28,7 +28,17 @@ Deploy this app with one-click via this link:
npm run bootstrap npm run bootstrap
``` ```
4. Run project locally 4. Set your Fauna API key value in your terminal enviroment
You can create faunaDB keys here: https://dashboard.fauna.com/db/keys
In your terminal run the following command:
```bash
export FAUNADB_SECRET=YourFaunaDBKeyHere
```
5. Run project locally
```bash ```bash
npm start npm start

View file

@ -63,6 +63,10 @@ function createFaunaDB(key) {
}) })
} }
/* util methods */
// Test if inside netlify build context
function insideNetlifyBuildContext() { function insideNetlifyBuildContext() {
if (process.env.DEPLOY_PRIME_URL) { if (process.env.DEPLOY_PRIME_URL) {
return true return true

View file

@ -8,12 +8,14 @@ function clear(){
}); });
} }
function checkForFaunaKey() { function checkForFaunaKey() {
if (!process.env.FAUNADB_SECRET) { if (!process.env.FAUNADB_SECRETz) {
console.log(chalk.yellow('Required FAUNADB_SECRET enviroment variable not found.')) console.log(chalk.yellow('Required FAUNADB_SECRET enviroment variable not found.'))
console.log(` console.log(`
========================= =========================
In your terminal run the following command You can create fauna DB keys here: https://dashboard.fauna.com/db/keys
In your terminal run the following command:
export FAUNADB_SECRET=YourFaunaDBKeyHere export FAUNADB_SECRET=YourFaunaDBKeyHere
@ -21,13 +23,7 @@ export FAUNADB_SECRET=YourFaunaDBKeyHere
`) `)
process.exit(1) process.exit(1)
process.stdout.write('\u001b[2J')
process.stdout.write('\u001b[1;1H')
} }
} }
process.on('exit', (err) => {
console.log('errr')
});
checkForFaunaKey() checkForFaunaKey()