debug cloud functions locally
Change-Id: I7fa072497b6e4b3980c88edb50481226f4ea3cad
This commit is contained in:
parent
8fed2d0659
commit
6cc4bf5ca6
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "start the server",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${workspaceFolder}/cmd/main.go",
|
||||||
|
"env": {
|
||||||
|
"GCP_PROJECT": "wormhole-315720",
|
||||||
|
"BIGTABLE_INSTANCE": "wormhole-mainnet",
|
||||||
|
"GOOGLE_APPLICATION_CREDENTIALS": "./bigtable-admin.json"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
|
||||||
|
p "github.com/certusone/wormhole/event_database/cloud_functions"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
ctx := context.Background()
|
||||||
|
if err := funcframework.RegisterHTTPFunctionContext(ctx, "/", p.Entry); err != nil {
|
||||||
|
log.Fatalf("funcframework.RegisterHTTPFunctionContext: %v\n", err)
|
||||||
|
}
|
||||||
|
// Use PORT environment variable, or default to 8080.
|
||||||
|
port := "8080"
|
||||||
|
if envPort := os.Getenv("PORT"); envPort != "" {
|
||||||
|
port = envPort
|
||||||
|
}
|
||||||
|
if err := funcframework.Start(port); err != nil {
|
||||||
|
log.Fatalf("funcframework.Start: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,15 @@
|
||||||
module github.com/certusone/wormhole/event_database/cloud_functions
|
module github.com/certusone/wormhole/event_database/cloud_functions
|
||||||
|
|
||||||
|
go 1.16
|
||||||
|
|
||||||
// cloud runtime is go 1.16. just for reference.
|
// cloud runtime is go 1.16. just for reference.
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/bigtable v1.10.1
|
cloud.google.com/go/bigtable v1.10.1
|
||||||
google.golang.org/api v0.48.0
|
google.golang.org/api v0.48.0 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/GoogleCloudPlatform/functions-framework-go v1.3.0
|
||||||
|
github.com/certusone/wormhole/node v0.0.0-20211027001206-19628733285e
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue