New returns a new Console.
(c *component.Component, config Config)
| 40 | |
| 41 | // New returns a new Console. |
| 42 | func 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 | |
| 67 | type ctxKeyType struct{} |
| 68 |
no test coverage detected