terraform deploy on ECS (#27)
This commit is contained in:
@@ -51,8 +51,8 @@ func NewConfig(confString string) (*Config, error) {
|
||||
conf := &Config{
|
||||
Port: 7880,
|
||||
RTC: RTCConfig{
|
||||
ICEPortRangeStart: 8000,
|
||||
ICEPortRangeEnd: 10000,
|
||||
ICEPortRangeStart: 9000,
|
||||
ICEPortRangeEnd: 9200,
|
||||
StunServers: []string{
|
||||
"stun.l.google.com:19302",
|
||||
"stun1.l.google.com:19302",
|
||||
|
||||
@@ -55,6 +55,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// require a claim
|
||||
if claims == nil || claims.Video == nil {
|
||||
handleError(w, http.StatusUnauthorized, rtc.ErrPermissionDenied.Error())
|
||||
return
|
||||
}
|
||||
identity := claims.Identity
|
||||
|
||||
@@ -170,22 +171,3 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type errStruct struct {
|
||||
StatusCode int `json:"statusCode"`
|
||||
Error string `json:"error"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func jsonError(code int, error ...string) errStruct {
|
||||
es := errStruct{
|
||||
StatusCode: code,
|
||||
}
|
||||
if len(error) > 0 {
|
||||
es.Error = error[0]
|
||||
}
|
||||
if len(error) > 1 {
|
||||
es.Message = error[1]
|
||||
}
|
||||
return es
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ func NewLivekitServer(conf *config.Config,
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle(s.roomServer.PathPrefix(), s.roomServer)
|
||||
mux.Handle("/rtc", rtcService)
|
||||
mux.HandleFunc("/", s.healthCheck)
|
||||
|
||||
s.httpServer = &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", conf.Port),
|
||||
@@ -141,6 +142,10 @@ func (s *LivekitServer) Stop() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LivekitServer) healthCheck(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// worker to perform periodic tasks per node
|
||||
func (s *LivekitServer) backgroundWorker() {
|
||||
roomTicker := time.NewTicker(30 * time.Second)
|
||||
|
||||
Reference in New Issue
Block a user