-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated Readme with full info * Updated grab-ngrok.js to use JSON.parse instead of Regex * Added better error catching for if Ngrok is not running properly * Added success message with new routing URL
- Loading branch information
Showing
4 changed files
with
33 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# gcp-proxy-func | ||
Very simple Google Cloud Function that proxies requests using Express and `http-proxy-middleware`. You define the address that requests should be proxied to by filling out config.js (copy `config.example.js` to `config.js`, and then change the URL). | ||
|
||
# Using | ||
Fill in `config.js`, and then either zip up the files and upload via Gcloud admin, or use [the Gcloud CLI](https://cloud.google.com/sdk/gcloud/) and `npm run deploy`. Or see below if using this to proxy to Ngrok. | ||
|
||
# Ngrok | ||
If you want to use this to have a stable Google Cloud Function address that proxies requests to a dynamic Ngrok address ([see this blog post for details](https://joshuatz.com/posts/2019/using-google-cloud-functions-permanent-url-to-proxy-ngrok-requests/)), you can automatically redeploy the function with the correct Ngrok public URL after it has changed, by using `npm run ngrok-deploy`. | ||
|
||
This command will grab the Ngrok public URL via the localhost API, update config.js by using `fs` to write to the file, and then redeploy your GCloud function to point to the updated URL. |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// @ts-check | ||
const config = require('./config'); | ||
console.log(`Success! GCloud config updated to route traffic to ${config.destination}`); |