MCPcopy Create free account
hub / github.com/rilldata/rill / ReloadAdminConfig

Method ReloadAdminConfig

cli/pkg/cmdutil/helper.go:139–157  ·  view source on GitHub ↗

ReloadAdminConfig populates the helper's AdminURL, AdminTokenDefault, and Org properties from ~/.rill.

()

Source from the content-addressed store, hash-verified

137
138// ReloadAdminConfig populates the helper's AdminURL, AdminTokenDefault, and Org properties from ~/.rill.
139func (h *Helper) ReloadAdminConfig() error {
140 adminToken, err := h.DotRill.GetAccessToken()
141 if err != nil {
142 return fmt.Errorf("could not parse access token from ~/.rill: %w", err)
143 }
144
145 adminURL, err := h.DotRill.GetDefaultAdminURL()
146 if err != nil {
147 return fmt.Errorf("could not parse default api URL from ~/.rill: %w", err)
148 }
149 if adminURL == "" {
150 adminURL = defaultAdminURL
151 }
152
153 h.AdminURLDefault = adminURL
154 h.AdminTokenDefault = adminToken
155
156 return nil
157}
158
159func (h *Helper) AdminToken() string {
160 if h.AdminTokenOverride != "" {

Callers 9

NewHelperFunction · 0.95
ClientMethod · 0.95
authCallbackHandlerMethod · 0.80
switchEnvFunction · 0.80
LoginFunction · 0.80
LogoutFunction · 0.80
AssumeCmdFunction · 0.80
UnassumeUserFunction · 0.80

Calls 3

GetDefaultAdminURLMethod · 0.80
ErrorfMethod · 0.65
GetAccessTokenMethod · 0.45

Tested by

no test coverage detected