Update sources take multiple URLs for future load-balancing

pull/154/head
Chris Goller 2016-09-29 18:07:54 -05:00
parent 283833afb1
commit 5ce883f0fc
3 changed files with 11 additions and 11 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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`