aboutsummaryrefslogtreecommitdiff
path: root/cmd/web/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web/main.go')
-rw-r--r--cmd/web/main.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/cmd/web/main.go b/cmd/web/main.go
index 045f60a..20c3506 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -21,9 +21,10 @@ var (
Listen = ":8899"
//go:embed static/*
- embeddedStatic embed.FS
- //go:embed templates/index.html
- indexTemplate string
+ StaticFS embed.FS
+ //go:embed templates/*
+ TemplateFS embed.FS
+ //indexTemplate string
)
func main() {
@@ -36,6 +37,9 @@ func main() {
fl.StringVar(&shareLink, "s", shareLink, "Share link, if blank make an educated guess")
isDemo := fl.Bool("demo", false,
"Whether or not to run in demo mode. You probably don't want this on.")
+ localFS := fl.String("fs", "",
+ "If not empty the local path to use instead of the "+
+ "embedded templates and /static directory.")
fl.Parse(os.Args[1:])
if *debug {
@@ -47,12 +51,14 @@ func main() {
Logger.Fatal(err)
}
+ if *localFS != "" {
+ a.useLocalFS(*localFS)
+ }
+
if *isDemo {
a.Demo = true
}
- go a.installer()
-
s := http.Server{Handler: a}
for i := 0; i < 5; i++ {
@@ -74,7 +80,8 @@ func main() {
continue
}
- startBrowser("http://localhost" + Listen)
+ // Not using 'localhost' due to the way windows listens by default
+ startBrowser("http://127.0.0.1" + Listen)
err = s.Serve(l)
if err != nil {