commit 2cd683c9831b3c4da84daaf5a72947d53eb48318
parent c4d2dfc39b1c1dd05b106296fb7e5026cfb67b27
Author: Chris Bracken <chris@bracken.jp>
Date: Mon, 11 Apr 2022 17:31:09 -0700
Support configurable asset path
Adds an -assets flag that can be used to specify the location of the web
assets to be served up by the HttpServer.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/main.go b/main.go
@@ -15,6 +15,7 @@ func main() {
dbuser := flag.String("user", "tempestas", "the database user")
dbpass := flag.String("password", "", "the database password")
addr := flag.String("address", ":8080", "HTTP service host:port")
+ assetDir := flag.String("assets", "static", "HTTP asset directory")
flag.Parse()
fmt.Println("Connecting to database")
@@ -22,6 +23,6 @@ func main() {
defer ds.Close()
fmt.Println("Waiting for requests at " + *addr)
- s := http.CreateServer(ds, "static")
+ s := http.CreateServer(ds, *assetDir)
log.Fatal(s.ListenAndServe(*addr))
}