diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8c6ce67 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/johanj/vault1984-web + +go 1.23.6 diff --git a/main.go b/main.go new file mode 100644 index 0000000..4e1c90c --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "embed" + "log" + "net/http" + "os" +) + +//go:embed *.html *.svg *.css +var static embed.FS + +func main() { + port := os.Getenv("PORT") + if port == "" { + port = "8099" + } + + http.Handle("/", http.FileServer(http.FS(static))) + + log.Printf("vault1984-web starting on :%s", port) + if err := http.ListenAndServe(":"+port, nil); err != nil { + log.Fatal(err) + } +}