| 168 | } |
| 169 | |
| 170 | func createSingleNodeServer(configUpdater func(*config.Config)) *service.LivekitServer { |
| 171 | var err error |
| 172 | conf, err := config.NewConfig("", true, nil, nil) |
| 173 | if err != nil { |
| 174 | panic(fmt.Sprintf("could not create config: %v", err)) |
| 175 | } |
| 176 | conf.Keys = map[string]string{testApiKey: testApiSecret} |
| 177 | conf.EnableDataTracks = true |
| 178 | if configUpdater != nil { |
| 179 | configUpdater(conf) |
| 180 | } |
| 181 | |
| 182 | currentNode, err := routing.NewLocalNode(conf) |
| 183 | if err != nil { |
| 184 | panic(fmt.Sprintf("could not create local node: %v", err)) |
| 185 | } |
| 186 | currentNode.SetNodeID(livekit.NodeID(guid.New(nodeID1))) |
| 187 | |
| 188 | s, err := service.InitializeServer(conf, currentNode) |
| 189 | if err != nil { |
| 190 | panic(fmt.Sprintf("could not create server: %v", err)) |
| 191 | } |
| 192 | |
| 193 | roomClient = livekit.NewRoomServiceJSONClient(fmt.Sprintf("http://localhost:%d", defaultServerPort), &http.Client{}) |
| 194 | return s |
| 195 | } |
| 196 | |
| 197 | func createMultiNodeServer(nodeID string, port uint32, configUpdater func(*config.Config)) *service.LivekitServer { |
| 198 | var err error |