Add swift-configuration support#50
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.
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.
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.
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.
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.