all repos — searchix @ b77a24f9f75378ffe97be83cf4dfd7f1683b9a7e

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: make fetcher check on creation that it supports Source.Importer

Alan Pearce
commit

b77a24f9f75378ffe97be83cf4dfd7f1683b9a7e

parent

c821da1cf55864852bcd8f337dd7acd0cc02f0b9

1 file changed, 18 insertions(+), 2 deletions(-)

changed files
M internal/fetcher/channel.gointernal/fetcher/channel.go
@@ -22,6 +22,23 @@ SourceFile string
Logger *slog.Logger } +func NewChannelFetcher( + source *config.Source, + dataPath string, + logger *slog.Logger, +) (*ChannelFetcher, error) { + switch source.Importer { + case config.Options: + return &ChannelFetcher{ + DataPath: dataPath, + Source: source, + Logger: logger, + }, nil + default: + return nil, fmt.Errorf("unsupported importer type %s", source.Importer) + } +} + func (i *ChannelFetcher) FetchIfNeeded( parent context.Context, ) (f FetchedFiles, updated bool, err error) {
@@ -91,8 +108,7 @@
updated = before != after f = FetchedFiles{ - Options: path.Join(dest, i.Source.OutputPath, "options.json"), - Packages: path.Join(dest, i.Source.OutputPath, "packages.json"), + Options: path.Join(dest, i.Source.OutputPath, "options.json"), } return