MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / New

Function New

pkg/console/console.go:42–65  ·  view source on GitHub ↗

New returns a new Console.

(c *component.Component, config Config)

Source from the content-addressed store, hash-verified

40
41// New returns a new Console.
42func New(c *component.Component, config Config) (*Console, error) {
43 config.OAuth.StateCookieName = "_console_state"
44 config.OAuth.AuthCookieName = "_console_auth"
45 config.OAuth.RootURL = config.UI.CanonicalURL
46 oc, err := oauthclient.New(c, config.OAuth)
47 if err != nil {
48 return nil, err
49 }
50
51 console := &Console{
52 Component: c,
53 oc: oc,
54 config: config,
55 }
56
57 if console.config.Mount == "" {
58 console.config.Mount = console.config.UI.MountPath()
59 }
60
61 c.RegisterWeb(console)
62 c.RegisterWeb(events.New(c))
63
64 return console, nil
65}
66
67type ctxKeyType struct{}
68

Callers 1

start.goFile · 0.92

Calls 4

NewFunction · 0.92
NewFunction · 0.92
MountPathMethod · 0.80
RegisterWebMethod · 0.80

Tested by

no test coverage detected