mirror of https://github.com/statping/statping
Merge pull request #256 from tufanbarisyildirim/feature/verify-ssl-to-bulk-import
add verifyssl field to csv import handler.pull/253/head^2
commit
bac38da703
|
@ -148,7 +148,7 @@ func bulkImportHandler(w http.ResponseWriter, r *http.Request) {
|
|||
// commaToService will convert a CSV comma delimited string slice to a Service type
|
||||
// this function is used for the bulk import services feature
|
||||
func commaToService(s []string) (*types.Service, error) {
|
||||
if len(s) != 16 {
|
||||
if len(s) != 17 {
|
||||
err := fmt.Errorf("does not have the expected amount of %v columns for a service", 16)
|
||||
return nil, err
|
||||
}
|
||||
|
@ -173,6 +173,11 @@ func commaToService(s []string) (*types.Service, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
verifySsl, err := strconv.ParseBool(s[16])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newService := &types.Service{
|
||||
Name: s[0],
|
||||
Domain: s[1],
|
||||
|
@ -189,6 +194,7 @@ func commaToService(s []string) (*types.Service, error) {
|
|||
GroupId: int(utils.ToInt(s[13])),
|
||||
Headers: types.NewNullString(s[14]),
|
||||
Permalink: types.NewNullString(s[15]),
|
||||
VerifySSL: types.NewNullBool(verifySsl),
|
||||
}
|
||||
|
||||
return newService, nil
|
||||
|
|
Loading…
Reference in New Issue