Created
March 7, 2019 02:55
-
-
Save j0hnm4r5/a9e2361e56226a1f357bb346292f9021 to your computer and use it in GitHub Desktop.
Netlify Free Password Protection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
..., | |
"scripts": { | |
"start": "gatsby develop -p 1234 -H 0.0.0.0", | |
"publish": "npm run _clean && npm run _build && npm run _encrypt && npm run _envDeploy", | |
"//": "========= PRIVATE SCRIPTS =========", | |
"_clean": "gatsby clean", | |
"_build": "gatsby build", | |
"_encrypt": "npx staticrypt public/index.html P@55W0RD -o public/index.html", | |
"_deploy": "npx netlify-cli deploy --dir=public --prod", | |
"_envDeploy": "NETLIFY_SITE_ID=abc-defg-hijk-lmnop NETLIFY_AUTH_TOKEN=abcdefg0123456789 bash -c 'npm run _deploy'" | |
}, | |
..., | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those not using Gatsby.
The way it works is you provide your html file, run staticrypt on it and get a new html file with password prompt and encrypted content from the original html you provided.
This essentialy means you just need to run this command:
npx staticrypt path-to-your-file/your-file.html -p <your-password>
In default it will create the new file in a folder named encrypted and this is the file you will want to host on netlify or any other platform.
You can find more info plus other command options here: https://www.npmjs.com/package/staticrypt
Wish you all the best!