Discover books, shows, and movies at your level. Track your progress by filling your Shelf with what you find, and share with other language learners. *No dusting required.
shlf.space
1package server
2
3import (
4 "context"
5 "fmt"
6
7 "shlf.space/internal/atproto"
8 "shlf.space/internal/cache"
9 "shlf.space/internal/cache/session"
10 "shlf.space/internal/config"
11 "shlf.space/internal/server/oauth"
12)
13
14type Server struct {
15 oauth *oauth.OAuth
16 config *config.Config
17 idResolver *atproto.Resolver
18 session *session.SessionStore
19}
20
21func Make(ctx context.Context, config *config.Config) (*Server, error) {
22 idResolver := atproto.DefaultResolver()
23
24 oauth, err := oauth.New(config, idResolver)
25 if err != nil {
26 return nil, fmt.Errorf("failed to start oauth handler: %w", err)
27 }
28
29 cache := cache.New(config.Redis.Addr)
30 session := session.New(cache)
31
32 return &Server{
33 oauth: oauth,
34 config: config,
35 idResolver: idResolver,
36 session: session,
37 }, nil
38}
39
40func (s *Server) Close() error {
41 return nil
42}