summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/app.go6
-rw-r--r--app/config.go3
-rw-r--r--media/library.go5
3 files changed, 13 insertions, 1 deletions
diff --git a/app/app.go b/app/app.go
index 4e0657c..387adc8 100644
--- a/app/app.go
+++ b/app/app.go
@@ -162,6 +162,12 @@ func (a *App) Run() error {
}
a.Watcher.Add(p.Path)
}
+ if err := os.MkdirAll(a.Config.Server.UploadPath, 0755); err != nil {
+ return fmt.Errorf(
+ "error creating upload path %s: %w",
+ a.Config.Server.UploadPath, err,
+ )
+ }
buildFeed(a)
go startWatcher(a)
return http.Serve(a.Listener, a.Router)
diff --git a/app/config.go b/app/config.go
index 4d72657..9c0e733 100644
--- a/app/config.go
+++ b/app/config.go
@@ -64,6 +64,7 @@ func DefaultConfig() *Config {
Server: &ServerConfig{
Host: "0.0.0.0",
Port: 8000,
+ StorePath: "tube.db",
UploadPath: "uploads",
MaxUploadSize: 104857600,
},
@@ -74,7 +75,7 @@ func DefaultConfig() *Config {
Timeout: 300,
},
Feed: &FeedConfig{
- ExternalURL: "http://localhost",
+ ExternalURL: "http://localhost:8000",
},
}
}
diff --git a/media/library.go b/media/library.go
index 5ea20e3..6bfedff 100644
--- a/media/library.go
+++ b/media/library.go
@@ -2,8 +2,10 @@ package media
import (
"errors"
+ "fmt"
"io/ioutil"
"log"
+ "os"
"path"
"path/filepath"
"strings"
@@ -39,6 +41,9 @@ func (lib *Library) AddPath(p *Path) error {
return errors.New("media: duplicate library prefix")
}
}
+ if err := os.MkdirAll(p.Path, 07550); err != nil {
+ return fmt.Errorf("error creating library path %s: %w", p.Path, err)
+ }
lib.Paths[p.Path] = p
return nil
}