blob: ec875f1bf67d7a957faec45cb2f24c8848638754 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package server
import (
"context"
"fmt"
"html/template"
"go.lindenii.runxiyu.org/forge/forged/internal/config"
"go.lindenii.runxiyu.org/forge/forged/internal/database"
"go.lindenii.runxiyu.org/forge/forged/internal/hooki"
"go.lindenii.runxiyu.org/forge/forged/internal/store"
)
type Server struct {
config config.Config
database database.Database
stores *store.Set
hookis *hooki.Pool
templates *template.Template
}
func New(ctx context.Context, config config.Config) (*Server, error) {
database, err := database.Open(ctx, config.DB)
if err != nil {
return nil, fmt.Errorf("open database: %w", err)
}
return &Server{
database: database,
}, nil
}
|