mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-15 02:32:21 +01:00
feat: improve ENV variable overrides, introduce Node struct, refactoring
This commit is contained in:
@@ -3,6 +3,7 @@ package http
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -44,6 +45,18 @@ func (s *Server) WithClusterAgent(agent *cluster.Agent) *Server {
|
||||
return s
|
||||
}
|
||||
|
||||
func Up(appConfig *config.Config, clusterAgent *cluster.Agent) *Server {
|
||||
srv := NewServer(appConfig)
|
||||
srv.WithClusterAgent(clusterAgent)
|
||||
srv.RegisterRoutes()
|
||||
|
||||
log.Printf("[INFO] Starting API server on %s", appConfig.Rcond.Addr)
|
||||
if err := srv.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return srv
|
||||
}
|
||||
|
||||
func (s *Server) Start() error {
|
||||
return s.srv.ListenAndServe()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user