alexcrichton / openssl-probe

Apache License 2.0
54 stars 13 forks source link

Add function to check if environment variables are configured corretly, fixes #7 #9

Closed timvisee closed 6 years ago

timvisee commented 6 years ago

This PR adds basic functionality in the crate to check whether the OpenSSL environment variables are configured and valid. This allows basic checking

The function has_ssl_cert_env_vars() has been added to determine whether any certificates will be found by OpenSSL through some basic environment variable checking.
The function init_ssl_cert_env_vars() now returns a bool to indicate whether any certificates were found while probing.
I've created constants for the environment variable keys to minimize duplication.

Note though, that these basic checks should be run before initializing OpenSSL, and that they are simple directory checks. It does currently not seem possible to actually check whehter the openssl crate is properly using these certificates, as it does not provide an interface for that.

Fixes #7

What do you think?

alexcrichton commented 6 years ago

Looks good to me, thanks!