Refactor feedkit boundaries ahead of v1
Remove global Postgres schema registration in favor of explicit schema-aware sink factory wiring, and update weatherfeeder to register the Postgres sink explicitly. Add optional per-source HTTP timeout and response body limit overrides while keeping feedkit defaults. Remove remaining legacy source/config compatibility surfaces, including singular kind support and old source registry/type aliases, and migrate weatherfeeder sources to plural `Kinds()` metadata. Clean up related docs, tests, and sample config to match the new Postgres, HTTP, and NATS configuration model.
This commit is contained in:
@@ -26,21 +26,10 @@ func requireStringParam(cfg config.SinkConfig, key string) (string, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// RegisterPostgresSchemaForConfiguredSinks registers one Postgres schema for each
|
||||
// configured sink using driver=postgres.
|
||||
func RegisterPostgresSchemaForConfiguredSinks(cfg *config.Config, schema PostgresSchema) error {
|
||||
if cfg == nil {
|
||||
return fmt.Errorf("register postgres schemas: config is nil")
|
||||
// PostgresFactory returns a sink factory that builds the built-in Postgres sink
|
||||
// using the provided downstream schema definition.
|
||||
func PostgresFactory(schema PostgresSchema) Factory {
|
||||
return func(cfg config.SinkConfig) (Sink, error) {
|
||||
return NewPostgresSinkFromConfig(cfg, schema)
|
||||
}
|
||||
|
||||
for i, sk := range cfg.Sinks {
|
||||
if !strings.EqualFold(strings.TrimSpace(sk.Driver), "postgres") {
|
||||
continue
|
||||
}
|
||||
if err := RegisterPostgresSchema(sk.Name, schema); err != nil {
|
||||
return fmt.Errorf("register postgres schema for sinks[%d] name=%q: %w", i, sk.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user