-
Notifications
You must be signed in to change notification settings - Fork 332
Support configuration file for Polaris CLI #154
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
Conversation
|
|
||
| for attr in ['client_id', 'client_secret', 'host', 'port']: | ||
| if not getattr(options, attr) and config.get(attr): | ||
| setattr(options, attr, config[attr]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't overwrite the default values of host and port, will make the change to overwrite.
| @staticmethod | ||
| def _load_config(): | ||
| try: | ||
| with open(POLARIS_CLI_JSON, "r") as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only support the current location, need to support the home dir(~) as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to allow a cli arg like -c configFile as well
|
On a high level I'm not sure that I think this is necessary and I would probably rather us not support this. I have concerns like:
|
We can document it with an example, and explanation of each fields, like this page does for PyIceberg(https://py.iceberg.apache.org/configuration/#rest-catalog)
It is the initial PR. We can enrich it over time.
I think it's worth to have it, if we consider Polaris Cli is a user-face tool, not only used for internal things like regression test. It is all about the ergonomic and better UX. For example, a user could have two Polaris catalogs to connect with, so that they can keep the config in a single file instead of inputing different parameter in the command line or switching the env variables every time. By saying that, this PR is not trying to have the full functionalities. It is a start point. |
Requested changes pushed. |
|
|
||
| @staticmethod | ||
| def _merge_with_config(options): | ||
| config = PolarisCli._load_config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do a quick rename of this to file_config or something like that? Just to make it clear the difference between options and config. The lines below are a little complicated to me otherwise
| if not config: | ||
| return | ||
|
|
||
| for attr in ['client_id', 'client_secret', 'host', 'port']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we want to allow-list only these props? Seems like we could allow anything here for future proofing?
I assume we could just have something like
for attr in config
If attr not in options
options[attr] = config[attr]|
@eric-maynard Could you follow up here? It looks like you had questions before on whether or not this should go forwards? |
|
Sorry, this is still in draft state. I'll close it, and reopen it once it's ready. |
|
@flyrain thinking to take this one if we still want to support it (unless u are continue working on this?) |
|
I'm not working on it. Feel free to pick it up. I think it'd be nice to support it. |
Sounds good. Yeah, too many local scripts to support when using CLI without the concept of loading from a profile. |
|
@sfc-gh-ygu here is a sample PR for this: #931 |
* Pass AccessConfig into FileIOFactory (apache#2937) it should not be the responsibility of the `FileIOFactory` to know how to infer the `AccessConfig` * Remove EclipseLink Persistence Backend (apache#2963) as per ML decision the deprecated eclipselink backend is being removed in the next version: https://lists.apache.org/thread/16bj5kngf2kfhqv3noxwfm7h9wlzvhyv * feat: Improve PolarisAdminTool default output (apache#2961) * feat: Improve PolarisAdminTool default output * feat: Improve PolarisAdminTool default output * Add Polaris Community Meeting 2025-10-30 (apache#2973) * Remove legacy management endpoints (apache#2276) * Build/nit: cache output of `generatedMarkdownDocs` (apache#2967) `(Java)Exec` tasks are not cacheable by default, as annotated with `@DisableCachingByDefault`. Adding an `outputs.cacheIf { true }` enables caching on those tasks. * Build: Helper to get effective ASF project metadata (apache#2969) This change "bundles" the information of `AsfProject` and the `PublishingHelperExtensions`, which is what the code in `configurePom.kt` did. Bundling these objects allows other consumers, like CycloneDX SBOM generation, to access that same information without having to query remote systems (whimsey.apache.org) again. * Alternative, concise PR template (apache#2945) This PR proposes an alternative PR template that is much shorter, and removes all the redundant claims. It also links to the contribution guidelines for further guidance. * Add docs how to add `Server` header to HTTP responses (apache#2941) * Prefer PolarisPrincipal over SecurityContext (apache#2932) The general idea is that `SecurityContext` comes from `jakarta.ws.rs` and there is no reason for non-REST related classes to rely on those details. Instead, once preprocessing of a REST-request has inferred the `PolarisPrincipal` all inner/core code should rely on only that. Note that this simplifies a bunch of tests that had to create their own `SecurityContext` around the principal that they wanted to use, thus having to decide how to implement `isUserInRole` and the other methods. * Last merged commit f934443 --------- Co-authored-by: Christopher Lambert <xn137@gmx.de> Co-authored-by: Yong Zheng <yongzheng0809@gmail.com> Co-authored-by: JB Onofré <jbonofre@apache.org> Co-authored-by: Alexandre Dutra <adutra@apache.org> Co-authored-by: fivetran-arunsuri <103934371+fivetran-arunsuri@users.noreply.github.com>
Description
Support a configuration file for Polaris CLI
Type of change
How Has This Been Tested?
Manually test the following uses:
Checklist: