photo-object-storage: MinIO on .13 (9010/9011), Go upload+serve /photos, admin S3 disk + Filament upload, migrated, deployed
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"wherewoof/frontend/internal/db"
|
||||
"wherewoof/frontend/internal/handlers"
|
||||
"wherewoof/frontend/internal/sms"
|
||||
"wherewoof/frontend/internal/storage"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -53,7 +54,13 @@ func main() {
|
||||
sender = sms.New(key, os.Getenv("SMS_API_SECRET"), os.Getenv("SMS_FROM"))
|
||||
}
|
||||
|
||||
app := handlers.New(db.New(pool), tpl, sender)
|
||||
// Object storage (MinIO) — nil when not configured.
|
||||
store, err := storage.NewClient()
|
||||
if err != nil {
|
||||
log.Fatal("storage:", err)
|
||||
}
|
||||
|
||||
app := handlers.New(db.New(pool), tpl, sender, store)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
|
||||
@@ -74,6 +81,7 @@ func main() {
|
||||
mux.Handle("POST /account/tags/{id}/edit", app.RequireAuth(app.EditTag))
|
||||
mux.Handle("POST /account/tags/{id}/delete", app.RequireAuth(app.DeleteTag))
|
||||
mux.Handle("POST /account/tags/{id}/photo", app.RequireAuth(app.UploadPhoto))
|
||||
mux.HandleFunc("GET /photos/{key...}", app.ServePhoto)
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: addr,
|
||||
|
||||
Reference in New Issue
Block a user