Auto-create books directory, log upload errors, document Docker deployment

- library.New now creates BOOKS_DIR (MkdirAll) on startup so uploads
  don't fail when the directory is missing on a fresh bind mount
- uploadSubmit logs the underlying OS error on save/write failures
- README: document docker-compose deployment, container UID/GID (100/101)
  for bind-mounted ./data permissions, and running the admin CLI via
  docker compose exec

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-15 07:11:33 +02:00
co-authored by Copilot
parent 4c0aa053ac
commit 0c3e5cec9f
4 changed files with 74 additions and 3 deletions
+5 -2
View File
@@ -19,8 +19,11 @@ type Service struct {
booksDir string
}
func New(booksDir string) *Service {
return &Service{booksDir: booksDir}
func New(booksDir string) (*Service, error) {
if err := os.MkdirAll(booksDir, 0o755); err != nil {
return nil, fmt.Errorf("books dir: %w", err)
}
return &Service{booksDir: booksDir}, nil
}
func (s *Service) BooksDir() string { return s.booksDir }