Faas semi worfking

This commit is contained in:
2025-08-30 23:52:37 -04:00
parent 2778cbc512
commit 67bce24899
23 changed files with 1089 additions and 135 deletions

View File

@ -0,0 +1,44 @@
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
// Read input from environment variable
input := os.Getenv("FUNCTION_INPUT")
if input == "" {
input = "{}"
}
// Parse input
var inputData map[string]interface{}
if err := json.Unmarshal([]byte(input), &inputData); err != nil {
fmt.Printf("Error parsing input: %v\n", err)
os.Exit(1)
}
// Process the input and generate output
name, ok := inputData["name"].(string)
if !ok {
name = "World"
}
message := fmt.Sprintf("Hello, %s!", name)
// Output result as JSON
result := map[string]interface{}{
"message": message,
"input": inputData,
}
output, err := json.Marshal(result)
if err != nil {
fmt.Printf("Error marshaling output: %v\n", err)
os.Exit(1)
}
fmt.Println(string(output))
}