puetzp / prometheus-http-query

Prometheus HTTP API client
MIT License
14 stars 7 forks source link

Conditional compilation and optional dependencies #4

Closed dev-defants closed 1 year ago

dev-defants commented 1 year ago

Hi,

Great project, thank you for it!

I would like to compile my project using rustls-tls and not being dependant of libssl. Could you extend the features flag of reqwest ?

Regards,

puetzp commented 1 year ago

Hey there,

Thank you for your suggestion. Please take a look at the referenced commit. Does this cover your use case? Note that I chose not to mirror all features related to TLS yet (like `reqwest/native-tls-alpn). And if it works for you I would leave it at that (for now).

dev-defants commented 1 year ago

Hi,

Thank you for you reactivity. I'm not very familiar with rust conditional compilation. Does it still include reqwest json whatever features for tls is selected ? The referenced commit looks good to me.

I will be waiting for 0.6.4 release.

Thank a lot

puetzp commented 1 year ago

Yes, the json feature will still be enabled. Also note that I decided to extend all TLS-related feature flags of reqwest after all. Contrary to what I opted for earlier.

Closing the issue as 0.6.4 is released.

dev-defants commented 1 year ago

Hi,

I have tried it and it's still quiet annoying, default features of reqwest are still up. It means that any program still depends on libssl. I don't know if it's possible for you to provide a flag to deactivate reqwest default features.

Sorry for the late discovery.

Regards,

ps: You do have a typo here; https://github.com/puetzp/prometheus-http-query/blob/master/Cargo.toml#L25

puetzp commented 1 year ago

I see, I think I rushed it a little bit. I need to take a deeper look at it first. I also yanked the latest release from crates.io. Will re-release when I made sure that everything is in order.

puetzp commented 1 year ago

Please take a look at the new release. If you disable the default features for prometheus-http-query and enable the rustls-tls feature, reqwest will be compiled with feature set [json, rustls-tls] and thus produce a binary that does not link to libssl:

prometheus-http-query = { version = "0.6", default-features = false, features = ["rustls-tls"] }

dev-defants commented 1 year ago

Hi,

It is perfect. Thank a lot.