serve templates from disk
This commit is contained in:
+11
-6
@@ -10,11 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
static := ""
|
||||
if s := os.Getenv("STATIC"); s != "" {
|
||||
static = s
|
||||
}
|
||||
|
||||
port := 8000
|
||||
if os.Getenv("PORT") != "" {
|
||||
p, err := strconv.Atoi(os.Getenv("PORT"))
|
||||
@@ -25,9 +20,19 @@ func main() {
|
||||
port = p
|
||||
}
|
||||
|
||||
static := ""
|
||||
if s := os.Getenv("STATIC"); s != "" {
|
||||
static = s
|
||||
}
|
||||
|
||||
tmpl := ""
|
||||
if t := os.Getenv("TEMPLATES"); t != "" {
|
||||
tmpl = t
|
||||
}
|
||||
|
||||
sm := http.NewServeMux()
|
||||
|
||||
web.NewServer(sm, static)
|
||||
web.NewSite(sm, static, tmpl)
|
||||
if err := http.ListenAndServe(fmt.Sprintf(":%d", port), sm); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "problem serving: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user