2015-02-09 22:23:42 -08:00
|
|
|
package main
|
|
|
|
|
2015-02-09 22:33:17 -08:00
|
|
|
import (
|
|
|
|
"net/http"
|
2015-02-09 23:11:06 -08:00
|
|
|
"os"
|
2015-02-09 23:01:28 -08:00
|
|
|
|
|
|
|
"github.com/elazarl/go-bindata-assetfs"
|
|
|
|
"mcquay.me/web"
|
2015-02-09 22:33:17 -08:00
|
|
|
)
|
2015-02-09 22:23:42 -08:00
|
|
|
|
|
|
|
func main() {
|
2015-02-09 23:11:06 -08:00
|
|
|
var fs http.FileSystem
|
|
|
|
if os.Getenv("SM_DEV") == "" {
|
|
|
|
fs = &assetfs.AssetFS{
|
2016-02-12 21:37:58 -08:00
|
|
|
Asset: web.Asset,
|
|
|
|
AssetDir: web.AssetDir,
|
|
|
|
AssetInfo: web.AssetInfo,
|
|
|
|
Prefix: "static",
|
2015-02-09 23:11:06 -08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fs = http.Dir(os.Getenv("SM_STATIC"))
|
|
|
|
}
|
2015-06-11 20:37:34 -07:00
|
|
|
// XXX: beware: I've copy/pasted this twice now and been confused because
|
|
|
|
// I ought to have been using my own servemux
|
2015-02-09 22:23:42 -08:00
|
|
|
http.Handle(
|
|
|
|
"/",
|
2015-02-09 23:11:06 -08:00
|
|
|
http.FileServer(fs),
|
2015-02-09 22:23:42 -08:00
|
|
|
)
|
|
|
|
if err := http.ListenAndServe(":8000", nil); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|