-
Notifications
You must be signed in to change notification settings - Fork 2
Add swift-configuration support #50
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 ease of reference, the table below displays the hierarchy of keys and associated information. Key names / hierarchy / type / default values are very much open for discussion.
|
…lit documentation
gjcairo
left a comment
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.
I think it may be worth adding these APIs (and the swift-configuration dependency) behind a trait, to avoid forcing this dependency on everyone.
https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/packagetraits/
| static let DEFAULT_MAX_FRAME_SIZE = 1 << 14 | ||
| static let DEFAULT_TARGET_WINDOW_SIZE = (1 << 16) - 1 | ||
| static let DEFAULT_MAX_CONCURRENT_STREAMS: Int? = nil |
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.
Style nit: I think we generally use camel case for constants. Also prefer to use inlinable computed static vars instead, for performance.
| let config = ConfigReader(provider: provider) | ||
| let snapshot = config.snapshot() | ||
|
|
||
| #expect(throws: Error.self) { |
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.
Can't we throw a more descriptive error here (and elsewhere)?
Tests/HTTPServerTests/NIOHTTPServerSwiftConfigurationTests.swift
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| // MARK: - TransportSecurity mTLS Tests |
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.
Nit, but we can have separate suites for each group of tests instead of having these marks and prefixing the test names with the group name.
That's certainly reasonable, let's just make sure it's behind a default trait. Generally we want ecosystem API package integration to be either built-in, or behind a default trait. We shouldn't put such integrations (logs/metrics/tracing/configuration/service lifecycle) behind opt-in traits, as that'd put quite a lot of obstacles in the way of folks just getting started. |
Motivation:
Users should be able to initialize
NIOHTTPServerConfigurationviaswift-configuration.Modifications:
Added a new initializer on
NIOHTTPServerConfiguration, which has aConfiguration.ConfigReaderargument. This initializer populates the four child types (BindTarget,TransportSecurity,BackpressureStrategy, andHTTP2) from the reader.Result:
Support for
swift-configurationadded.