Add netlify toml

This commit is contained in:
I Made Setia Baruna 2021-01-09 01:27:08 +08:00
parent 1a8063f6fe
commit 5badfa804d
2 changed files with 16 additions and 0 deletions

9
netlify.toml Normal file
View file

@ -0,0 +1,9 @@
[build]
publish = "__sapper__/export"
command = "node scripts/createEnv.js && yarn export"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200

7
scripts/createEnv.js Normal file
View file

@ -0,0 +1,7 @@
const fs = require('fs');
let envString = '';
envString += `GOOGLE_DRIVE_CLIENT_ID=${process.env.GOOGLE_DRIVE_CLIENT_ID}\n`;
envString += `GOOGLE_DRIVE_API_KEY=${process.env.GOOGLE_DRIVE_API_KEY}\n`;
fs.writeFileSync('.env', envString);