mirror of
https://github.com/btouchard/ackify.git
synced 2026-05-18 23:08:33 -05:00
53aa233f66
- Admin middleware with ACKIFY_ADMIN_EMAILS environment variable authentication
- Dashboard view listing all documents with signature counts (/admin)
- Document details view showing signataires and metadata (/admin/docs/{docID})
- Read-only admin repository with dedicated database connection
- Responsive UI templates consistent with existing design
- Secure route protection and proper error handling
Configuration: Set ACKIFY_ADMIN_EMAILS="email1@domain.com,email2@domain.com"
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/btouchard/ackify-ce/internal/presentation/admin"
|
|
"github.com/btouchard/ackify-ce/pkg/web"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
|
|
server, err := web.NewServer(ctx)
|
|
if err != nil {
|
|
log.Fatalf("Failed to create server: %v", err)
|
|
}
|
|
|
|
// Register admin routes
|
|
server.RegisterRoutes(admin.RegisterAdminRoutes(server.GetBaseURL(), server.GetTemplates()))
|
|
|
|
go func() {
|
|
log.Printf("Community Edition server starting on %s", server.GetAddr())
|
|
if err := server.Start(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
|
log.Fatalf("Server error: %v", err)
|
|
}
|
|
}()
|
|
|
|
quit := make(chan os.Signal, 1)
|
|
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
|
<-quit
|
|
|
|
log.Println("Shutting down Community Edition server...")
|
|
|
|
shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
defer cancel()
|
|
|
|
if err := server.Shutdown(shutdownCtx); err != nil {
|
|
log.Printf("Server forced to shutdown: %v", err)
|
|
}
|
|
|
|
log.Println("Community Edition server exited")
|
|
}
|