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

View File

@ -3,6 +3,7 @@ package main
import (
"github.com/spf13/afero"
"time"
"log"
)
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.
func (t *Theme) Open(name string) (ReadSeekCloser, error) {
log.Println(name)
return t.Fs.Open(name)
}