Refactor to move cloud fn to top level
This commit is contained in:
parent
28abf0e461
commit
3559ca9ec1
14 changed files with 14 additions and 13 deletions
29
cmd/fn-framework-test/main.go
Normal file
29
cmd/fn-framework-test/main.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
// Blank-import the function package so the init() runs
|
||||
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
|
||||
_ "github.com/ray1729/wordsearch"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Use PORT environment variable, or default to 8080.
|
||||
port := "8080"
|
||||
if envPort := os.Getenv("PORT"); envPort != "" {
|
||||
port = envPort
|
||||
}
|
||||
|
||||
// By default, listen on all interfaces. If testing locally, run with
|
||||
// LOCAL_ONLY=true to avoid triggering firewall warnings and
|
||||
// exposing the server outside of your own machine.
|
||||
hostname := ""
|
||||
if localOnly := os.Getenv("LOCAL_ONLY"); localOnly == "true" {
|
||||
hostname = "127.0.0.1"
|
||||
}
|
||||
if err := funcframework.StartHostPort(hostname, port); err != nil {
|
||||
log.Fatalf("funcframework.StartHostPort: %v\n", err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue