Skip to content

Commit

Permalink
Merge pull request #266 from cdnjs/sven/ExcludeFromSearch
Browse files Browse the repository at this point in the history
add excludeFromSearch autoupdate field
  • Loading branch information
xtuc authored Jul 31, 2023
2 parents c81b403 + ab399e1 commit 55348b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions functions/algolia-pump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ func Invoke(ctx context.Context, e gcp.GCSEvent) error {
if err := json.Unmarshal([]byte(configStr), &pkg); err != nil {
return fmt.Errorf("could not decode config: %v", err)
}

if pkg.Autoupdate != nil && pkg.Autoupdate.ExcludeFromSearch != nil && *pkg.Autoupdate.ExcludeFromSearch {
// The package is exluded from the search index. Stop processing here.
log.Printf("%s: excluded from search. Exiting.\n", pkgName)
return nil
}

// update package version with latest
versions, err := getExistingVersionsFromAggregatedMetadata(pkg)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ type Author struct {
// Autoupdate is used to update particular files from
// a source type located at a target destination.
type Autoupdate struct {
Source *string `json:"source,omitempty"`
Target *string `json:"target,omitempty"`
FileMap []FileMap `json:"fileMap,omitempty"`
IgnoreVersions []string `json:"ignoreVersions,omitempty"`
Source *string `json:"source,omitempty"`
Target *string `json:"target,omitempty"`
FileMap []FileMap `json:"fileMap,omitempty"`
IgnoreVersions []string `json:"ignoreVersions,omitempty"`
ExcludeFromSearch *bool `json:"excludeFromSearch,omitempty"`
}

// Optimization is used to enable/disable optimization
Expand Down

0 comments on commit 55348b2

Please sign in to comment.