diff options
Diffstat (limited to 'internal/fetcher/download.go')
-rw-r--r-- | internal/fetcher/download.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/fetcher/download.go b/internal/fetcher/download.go index 4165886..2c7b8fd 100644 --- a/internal/fetcher/download.go +++ b/internal/fetcher/download.go @@ -2,6 +2,7 @@ package fetcher import ( "context" + "fmt" "log/slog" "net/url" "path" @@ -18,6 +19,23 @@ type DownloadFetcher struct { Logger *slog.Logger } +func NewDownloadFetcher( + source *config.Source, + dataPath string, + logger *slog.Logger, +) (*DownloadFetcher, error) { + switch source.Importer { + case config.Options: + return &DownloadFetcher{ + DataPath: dataPath, + Source: source, + Logger: logger, + }, nil + default: + return nil, fmt.Errorf("unsupported importer type %s", source.Importer) + } +} + var files = map[string]string{ "revision": "revision", "options": "options.json", |