Update sources take multiple URLs for future load-balancing
parent
283833afb1
commit
5ce883f0fc
|
@ -113,7 +113,7 @@ func (c *Client) MonitoredServices(ctx context.Context) ([]mrfusion.MonitoredSer
|
|||
}
|
||||
|
||||
func (c *Client) Connect(ctx context.Context, src *mrfusion.Source) error {
|
||||
u, err := url.Parse(src.URL)
|
||||
u, err := url.Parse(src.URL[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ func (m *Handler) NewSource(ctx context.Context, params op.PostSourcesParams) mi
|
|||
Type: params.Source.Type,
|
||||
Username: params.Source.Username,
|
||||
Password: params.Source.Password,
|
||||
URL: *params.Source.URL,
|
||||
URL: []string{*params.Source.URL},
|
||||
Default: params.Source.Default,
|
||||
}
|
||||
var err error
|
||||
|
@ -75,7 +75,7 @@ func mrToModel(src mrfusion.Source) *models.Source {
|
|||
Type: src.Type,
|
||||
Username: src.Username,
|
||||
Password: src.Password,
|
||||
URL: &src.URL,
|
||||
URL: &src.URL[0],
|
||||
Default: src.Default,
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ func (m *Handler) UpdateSource(ctx context.Context, params op.PatchSourcesIDPara
|
|||
src.Username = params.Config.Username
|
||||
}
|
||||
if params.Config.URL != nil {
|
||||
src.URL = *params.Config.URL
|
||||
src.URL = []string{*params.Config.URL}
|
||||
}
|
||||
if params.Config.Type != "" {
|
||||
src.Type = params.Config.Type
|
||||
|
|
14
stores.go
14
stores.go
|
@ -118,13 +118,13 @@ type DashboardStore interface {
|
|||
}
|
||||
|
||||
type Source struct {
|
||||
ID int // ID is the unique ID of the source
|
||||
Name string // Name is the user-defined name for the source
|
||||
Type string // Type specifies which kinds of source (enterprise vs oss)
|
||||
Username string // Username is the username to connect to the source
|
||||
Password string // Password is in CLEARTEXT FIXME
|
||||
URL string // URL is the connection URL to the source
|
||||
Default bool // Default specifies the default source for the application
|
||||
ID int // ID is the unique ID of the source
|
||||
Name string // Name is the user-defined name for the source
|
||||
Type string // Type specifies which kinds of source (enterprise vs oss)
|
||||
Username string // Username is the username to connect to the source
|
||||
Password string // Password is in CLEARTEXT FIXME
|
||||
URL []string // URL are the connections to the source
|
||||
Default bool // Default specifies the default source for the application
|
||||
}
|
||||
|
||||
// SourcesStore stores connection information for a `TimeSeries`
|
||||
|
|
Loading…
Reference in New Issue