Closed paurkedal closed 8 months ago
The gmap library provides an arguably simpler interface than hmap, but the difference is essential here, since gmap is better suited for closed key types.
I pushed a sketch to the config-2022 branch. Though it is more or less complete functionality-wise, I am less sure about the API, so I'm parking this for now to avoid committing to the design before it is needed.
A fairly light solution was chosen, covering only TLS parameters, at least for now.
Issue #86 highlighted the need for a way to configure Caqti connections, apart from when can reasonably be fitted into the endpoint URL. The upcoming PGX support (#38) will also need a way to configure TLS, which calls for another solution.
Considering generic TLS configurations, note that drivers based on C bindings accepts file paths while the tls library accepts in-memory cryptographic content. A unified TLS configuration would therefore involve loading and storing files depending on what is provided and what is needed. A unified configuration will be even more challenging if we wish to support a road range of driver-specific parameters.
A better option may therefore be to use an open type for the configuration keys and a hmap(-like) value to store them. This would allow defining configuration keys in sub-libraries, e.g. using
Tls.Config.client
to configure the usage of the tls library, while avoiding the dependency in the core library.