Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config File Handling #156

Merged
merged 5 commits into from
Oct 17, 2024
Merged

Config File Handling #156

merged 5 commits into from
Oct 17, 2024

Conversation

alex-kar
Copy link
Contributor

Handle config file .iceberg-go.yaml in the home directory.

Closes #62

@zeroshade I noticed that --catalog has different functionality compare to pyiceberg cli, where it defines catalog name to be loaded from configuration file.

iceberg-go - --catalog - catalog type.
pyiceberg --catalog - catalog name to load from configuration file.

Because of this reason, currently it can load only default catalog.

Another note is that docopt throw's exception when struct has some non default values.
docopt/docopt.go#55
Because of this limitation, I can't first parse configuration file and then provide the same struct to docopt to ensure the correct precedence. instead I added this manual mapping:

func mergeConf(fileConf *config.CatalogConfig, resConfig *Config) {
	if len(resConfig.Catalog) == 0 {
		resConfig.Catalog = fileConf.Catalog
	}
	...
}

Comment on lines 108 to 112
if err := args.Bind(&cfg); err != nil {
log.Fatal(err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we probably add an option to specify the config file if they want something other than the default .iceberg-go.yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeroshade I have added --config option to specify the path to the configuration file.

Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!!

@nastra
Copy link
Contributor

nastra commented Oct 17, 2024

@alex-kar can you please rebase and fix the merge conflict?

@alex-kar
Copy link
Contributor Author

@nastra Rebased onto the latest main.

@nastra nastra merged commit 3b5daaa into apache:main Oct 17, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config File Handling
3 participants