MCPcopy Index your code
hub / github.com/devspace-sh/devspace / UI

Function UI

pkg/devspace/dev/dev.go:12–41  ·  view source on GitHub ↗
(ctx devspacecontext.Context, port int, showUI bool, pipeline types.Pipeline)

Source from the content-addressed store, hash-verified

10)
11
12func UI(ctx devspacecontext.Context, port int, showUI bool, pipeline types.Pipeline) (*server.Server, error) {
13 var defaultPort *int
14 if port != 0 {
15 defaultPort = &port
16 }
17
18 // Create server
19 uiLogger := log.GetFileLogger("ui")
20 serv, err := server.NewServer(ctx.WithLogger(uiLogger), "localhost", false, defaultPort, pipeline)
21 if err != nil {
22 ctx.Log().Warnf("Couldn't start UI server: %v", err)
23 } else {
24 // Start server
25 go func() {
26 _ = serv.ListenAndServe()
27 }()
28
29 go func() {
30 <-ctx.Context().Done()
31 _ = serv.Server.Close()
32 }()
33
34 if showUI {
35 ctx.Log().WriteString(logrus.InfoLevel, "\n#########################################################\n")
36 ctx.Log().Infof("DevSpace UI available at: %s", ansi.Color("http://"+serv.Server.Addr, "white+b"))
37 ctx.Log().WriteString(logrus.InfoLevel, "#########################################################\n\n")
38 }
39 }
40 return serv, nil
41}

Callers 1

runPipelineFunction · 0.92

Calls 11

ListenAndServeMethod · 0.95
GetFileLoggerFunction · 0.92
NewServerFunction · 0.92
WithLoggerMethod · 0.65
LogMethod · 0.65
DoneMethod · 0.65
ContextMethod · 0.65
CloseMethod · 0.65
WriteStringMethod · 0.65
WarnfMethod · 0.45
InfofMethod · 0.45

Tested by

no test coverage detected