Skip to content

Commit

Permalink
rename repository
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <[email protected]>
  • Loading branch information
onur-ozkan committed Jul 21, 2023
1 parent 1404534 commit 685afa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
go.work

# binary
repository_index_proxy
package_search_api
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module repository_index_proxy
module package_search_api

go 1.20

Expand Down
10 changes: 6 additions & 4 deletions repository-index-proxy.go → package-search-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ func validateSearchValue(pkg_search string) error {
return errors.New("package' length can not be greater than 50.")
}

pkgNameRegex := regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)
if len(pkg_search) > 0 {
pkgNameRegex := regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)

if !pkgNameRegex.MatchString(pkg_search) {
return errors.New("Package name can only contain English alphabets, numbers, '-' and '_' characters.")
if !pkgNameRegex.MatchString(pkg_search) {
return errors.New("Package name can only contain English alphabets, numbers, '-' and '_' characters.")
}
}

return nil
Expand Down Expand Up @@ -192,7 +194,7 @@ func main() {
// Apply the gzip middleware to the entire mux
handler := gzipMiddleware(mux)

fmt.Printf("repository-index-proxy server is listening on port %s for %s\n", apiPort, DB_PATH)
fmt.Printf("package-search-api is listening on port %s for %s\n", apiPort, DB_PATH)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", apiPort), handler))

}

0 comments on commit 685afa1

Please sign in to comment.