Skip to content

Add validation/warning for unsupported config file extensions #690

@dlevy-msft-sql

Description

@dlevy-msft-sql

Description:
Currently, when users specify a config file with an unsupported extension (e.g., --sqlconfig myfile.txt), they receive a confusing Viper error: "Unsupported Config Type 'txt'".

Proposed Enhancement:
Add validation in internal/config/viper.go to check the file extension before passing to Viper and provide a clearer error message such as:

Error: Configuration files must use YAML format with .yaml or .yml extension.
The file 'myfile.txt' has an unsupported extension '.txt'.

Related:

Implementation Notes:

  • Check file extension in configureViper() or SetFileName() function
  • Allow .yaml, .yml, and no extension (for default ~/.sqlcmd/sqlconfig)
  • Provide helpful error message pointing users to documentation

Metadata

Metadata

Labels

Priority: 3Low priority/impactSize: SSmall issue (less than one week effort)enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions