43 lines
849 B
Go
43 lines
849 B
Go
package admin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.cadoles.com/cadoles/bouncer/internal/setup"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func (s *Server) initRepositories(ctx context.Context) error {
|
|
if err := s.initLayerRepository(ctx); err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
if err := s.initProxyRepository(ctx); err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Server) initLayerRepository(ctx context.Context) error {
|
|
layerRepository, err := setup.NewLayerRepository(ctx, s.redisConfig)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
s.layerRepository = layerRepository
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Server) initProxyRepository(ctx context.Context) error {
|
|
proxyRepository, err := setup.NewProxyRepository(ctx, s.redisConfig)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
s.proxyRepository = proxyRepository
|
|
|
|
return nil
|
|
}
|