Skip to content

Commit

Permalink
add comment that explains why gosearch uses repo config.yaml and not …
Browse files Browse the repository at this point in the history
…local config.yaml
  • Loading branch information
ibnaleem committed Nov 24, 2024
1 parent 23a2431 commit c026eab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gosearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ type Cookie struct {
}

func UnmarshalYAML() (Config, error) {

// GoSearch relies on config.yaml to determine the websites to search for.
// Instead of forcing uers to manually download the config.yaml file, we will fetch the latest version from the repository.
// Thereforeore, we will do the following:
// 1. Delete the existing config.yaml file if it exists as it will be outdated in the future
// 2. Read the latest config.yaml file from the repository
// Bonus: it does not download the config.yaml file, it just reads it from the repository.

err := os.Remove("config.yaml")
if err != nil && !os.IsNotExist(err) {
return Config{}, fmt.Errorf("error deleting old config.yaml: %w", err)
Expand Down

0 comments on commit c026eab

Please sign in to comment.