Skip to content

Fail fast on unknown local datasource type #93

Description

@mayankpande88

An unknown local datasource type is only caught deep inside proxy construction (cmd/app.go:191-193), where it is logged as a warning and silently skipped. The datasource simply never appears, which makes a typo (e.g. postgres vs postgresql) hard to diagnose.

Proposed scope

  • Add validation that rejects any LocalDatasource.Type outside the known set, ideally at config load (config.Load) so it fails fast with a clear error listing the supported types.
  • Keep the known-type list as a single source of truth shared with the switch ds.Type in cmd/app.go (avoid duplicating the list).

Known types

postgresql, mysql, mssql, clickhouse, oracle, http, prometheus, ssh, mongodb, redis, kafka, mcp (see cmd/app.go:131-194).

Acceptance criteria

  • Unit test: a known type validates; an unknown type returns an error whose message lists supported types.

Pointers

  • cmd/app.go:131-194 (type switch + current default warning)
  • pkg/config/config.go (LocalDatasource, Load)

Good first issue: clear scope; main design choice is where to put the shared type list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update go codegood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions