server.go 541 B

1234567891011121314151617181920212223242526272829
  1. package server
  2. import (
  3. "github.com/torkelo/grafana-pro/pkg/api"
  4. "github.com/torkelo/grafana-pro/pkg/configuration"
  5. "github.com/torkelo/grafana-pro/pkg/stores"
  6. )
  7. type Server struct {
  8. HttpServer *api.HttpServer
  9. Store stores.Store
  10. }
  11. func NewServer(cfg *configuration.Cfg) (*Server, error) {
  12. store := stores.New()
  13. httpServer := api.NewHttpServer(cfg, store)
  14. return &Server{
  15. HttpServer: httpServer,
  16. Store: store,
  17. }, nil
  18. }
  19. func (self *Server) ListenAndServe() error {
  20. self.HttpServer.ListenAndServe()
  21. return nil
  22. }