This repository contains an HTTP POST provider for SnapMaster. It handles POST requests to a webhook-like URL which a user can call, and acts as a trigger to a SnapMaster snap (workflow). The main work it does is to validate a shared secret, and then invoke the appropriate snap hosted by the SnapMaster-API service.
Provider-HTTPPOST utilizes the express web server, and relies on Auth0 for authenticating calls (which can only be made with authorization tokens obtained from the Auth0 token endpoint).
It is a Google Cloud Platform app, with dependencies on Google Cloud Build, Google Cloud Run, and Google Cloud Pubsub.
Runs the backend with ENV=dev, which invokes the dev environment.
The express webserver will default to listening on port 8082. Override with PORT=xxxx variable.
Runs the backend with ENV=prod, which invokes the production environment.
The express webserver will default to listening on port 8080. Override with PORT=xxxx variable.
Runs the backend with dev account credentials but with the prod
configuration, which runs
a production-like hosted environment in the dev account.
These will build the Docker container for the provider using Google Cloud Build, and deploy it to Google Cloud Run.
This combines the build
and deploy
operations to automate the deployment of the current source code with one command into the respective environment.
The app is bootstrapped out of index.js
, which pulls in all other source dependencies out of the src
directory.
Contains all the config for the project. These files aren't committed to source control since they contain secrets.
The provider expects an auth0_config_{dev|prod}.json
file for application keys and secret keys for your Auth0 tenant.
{
"domain": "YOURDOMAIN.auth0.com",
"client_id": "THE CLIENT ID FOR YOUR DOMAIN",
"client_secret": "THE CLIENT SECRET FOR YOUR DOMAIN",
"audience": "https://api.snapmaster.io"
}
Contains scripts to build and deploy the provider to GCP.
Contains scaffolding source files (environment.js
, requesthandler.js
) that can be reused across provider implementations.
Contains the provider-specific code.