Merge pull request #256 from tufanbarisyildirim/feature/verify-ssl-to-bulk-import

add verifyssl field to csv import handler.
pull/253/head^2
Hunter Long 2019-10-15 08:51:50 -07:00 committed by GitHub
commit bac38da703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -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 // commaToService will convert a CSV comma delimited string slice to a Service type
// this function is used for the bulk import services feature // this function is used for the bulk import services feature
func commaToService(s []string) (*types.Service, error) { 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) err := fmt.Errorf("does not have the expected amount of %v columns for a service", 16)
return nil, err return nil, err
} }
@ -173,6 +173,11 @@ func commaToService(s []string) (*types.Service, error) {
return nil, err return nil, err
} }
verifySsl, err := strconv.ParseBool(s[16])
if err != nil {
return nil, err
}
newService := &types.Service{ newService := &types.Service{
Name: s[0], Name: s[0],
Domain: s[1], Domain: s[1],
@ -189,6 +194,7 @@ func commaToService(s []string) (*types.Service, error) {
GroupId: int(utils.ToInt(s[13])), GroupId: int(utils.ToInt(s[13])),
Headers: types.NewNullString(s[14]), Headers: types.NewNullString(s[14]),
Permalink: types.NewNullString(s[15]), Permalink: types.NewNullString(s[15]),
VerifySSL: types.NewNullBool(verifySsl),
} }
return newService, nil return newService, nil