wordsearch/cmd/fn-framework-test/main.go

30 lines
782 B
Go
Raw Normal View History

2023-10-08 14:25:57 +01:00
package main
import (
"log"
"os"
// Blank-import the function package so the init() runs
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
2023-10-08 15:05:12 +01:00
_ "github.com/ray1729/wordsearch"
2023-10-08 14:25:57 +01:00
)
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)
}
}