41 lines
595 B
Go
41 lines
595 B
Go
package handlers
|
|
|
|
import (
|
|
"database/sql"
|
|
"html/template"
|
|
|
|
"git.tavo.one/tavo/axiom/storage"
|
|
)
|
|
|
|
type Handler struct {
|
|
cfg Config
|
|
}
|
|
|
|
type Config struct {
|
|
Production bool
|
|
Views map[string]*template.Template
|
|
DB *sql.DB
|
|
S3 *storage.Client
|
|
}
|
|
|
|
func New(cfg Config) *Handler {
|
|
return &Handler{
|
|
cfg: cfg,
|
|
}
|
|
}
|
|
|
|
func (h *Handler) Production() bool {
|
|
return h.cfg.Production
|
|
}
|
|
|
|
func (h *Handler) Views() map[string]*template.Template {
|
|
return h.cfg.Views
|
|
}
|
|
|
|
func (h *Handler) DB() *sql.DB {
|
|
return h.cfg.DB
|
|
}
|
|
|
|
func (h *Handler) S3() *storage.Client {
|
|
return h.cfg.S3
|
|
}
|