Serving theme files

This commit is contained in:
Neale Pickett 2020-02-29 16:59:44 -07:00
parent ffc705ec8b
commit 53947e2d64
2 changed files with 5 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/namsral/flag" "flag"
"github.com/spf13/afero" "github.com/spf13/afero"
"log" "log"
"mime" "mime"
@ -47,7 +47,7 @@ func main() {
) )
bindStr := flag.String( bindStr := flag.String(
"bind", "bind",
":8000", ":8080",
"Bind [host]:port for HTTP service", "Bind [host]:port for HTTP service",
) )
base := flag.String( base := flag.String(
@ -55,6 +55,7 @@ func main() {
"/", "/",
"Base URL of this instance", "Base URL of this instance",
) )
flag.Parse()
theme := NewTheme(afero.NewBasePathFs(afero.NewOsFs(), *themePath)) theme := NewTheme(afero.NewBasePathFs(afero.NewOsFs(), *themePath))
state := NewState(afero.NewBasePathFs(afero.NewOsFs(), *statePath)) state := NewState(afero.NewBasePathFs(afero.NewOsFs(), *statePath))

View File

@ -3,6 +3,7 @@ package main
import ( import (
"github.com/spf13/afero" "github.com/spf13/afero"
"time" "time"
"log"
) )
type Theme struct { type Theme struct {
@ -17,6 +18,7 @@ func NewTheme(fs afero.Fs) *Theme {
// I don't understand why I need this. The type checking system is weird here. // I don't understand why I need this. The type checking system is weird here.
func (t *Theme) Open(name string) (ReadSeekCloser, error) { func (t *Theme) Open(name string) (ReadSeekCloser, error) {
log.Println(name)
return t.Fs.Open(name) return t.Fs.Open(name)
} }