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

Global config for Hearth clients #207

Merged
merged 11 commits into from
Jul 11, 2024
Merged

Global config for Hearth clients #207

merged 11 commits into from
Jul 11, 2024

Conversation

mullermp
Copy link
Contributor

@mullermp mullermp commented Jun 29, 2024

Config defaults need to remain inside the Config struct and Config must expose the original provided options. This is so global config plugin knows what was configured already (it may be nil).

Needs tests and some more thought on approach. Options are being modified by resolver, it would be preferable not to.

@mullermp
Copy link
Contributor Author

mullermp commented Jul 3, 2024

TODO: test for global being overwritten (hierarchy?) and value validation

Copy link
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

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

Per our convo, may need test coverage on the following:

  • Ensure that the inherited global config on the client level is validated
  • Confirm client can override config that was inherited from global

Copy link
Contributor

@alextwoods alextwoods left a comment

Choose a reason for hiding this comment

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

I like the approach of adding the options to Config, but I'm not sure about supporting a global Hearth.config.

attr_reader :config

# @param [Hash] config
def config=(config)
Copy link
Contributor

Choose a reason for hiding this comment

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

While I do think global config is okay for AWS clients, I'm a little skeptical about supporting it for all generic Hearth clients - I think it could be a little bit of a foot gun if someone is using smithy-ruby clients for vastly different services.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. Let's chat offline.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do want to support generic global config - what about only supporting it in the generated SDK's namespace. Eg: RailsJson.config or AWS::SDK::S3.config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we will also need per-service global config and AWS global config, but I think Hearth global config is still fine here. Yes there are risks, and I understand it may seem funky, but I think it's correct to have config at every level.

hearth/lib/hearth/client.rb Show resolved Hide resolved
@mullermp mullermp merged commit 6a35402 into main Jul 11, 2024
22 checks passed
@mullermp mullermp deleted the global-config branch July 11, 2024 17:11
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.

3 participants