rasta-rocket opened a new pull request, #1319:
URL: https://github.com/apache/iceberg-go/pull/1319
## Problem
The CLI `--catalog-name` flag defaults to `"default"`. When a config file
used a different name under `default-catalog`, that value was never read ‚
`ParseConfig` was called with the flag's default before the config file had any
chance to influence it. The result was a silent fallback to the `rest` catalog
type with no URI, producing a confusing error:
```
Get "v1/config": unsupported protocol scheme ""
```
Example config that triggered the bug:
```yaml
default-catalog: my-catalog
catalog:
my-catalog:
type: glue
warehouse: s3://my-bucket
```
Running iceberg list would fail because my-catalog was never found in the
catalog map, mergeConf was never called, and the catalog type stayed as rest.
## Fix
- Add config.ParseDefaultCatalog to extract default-catalog from the YAML
without requiring a catalog name upfront.
- In main, load the config bytes once, then seed args.CatalogName from
default-catalog when `--catalog-name` was not explicitly passed on the command
line. The explicit-flag guard ensures CLI flags still take precedence.
## How to test
1. Create ~/.iceberg-go.yaml with a non-"default" catalog name:
```yaml
default-catalog: my-glue
catalog:
my-glue:
type: glue
warehouse: s3://my-bucket
```
2. Run without --catalog-name:
```shell
AWS_PROFILE=my-profile AWS_REGION=my-region iceberg list
```
2. Before: Get "v1/config": unsupported protocol scheme ""
After: connects to the Glue catalog correctly.
3. Verify explicit flag still wins:
```shell
iceberg --catalog-name other-catalog list
```
4. Should use other-catalog, not my-glue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]