pub fn from_env() -> Result<NeptuneEndpoint, Error> {
        Ok(NeptuneEndpoint {
            host: env_string("WG_GREMLIN_HOST")?,
            port: env_u16("WG_GREMLIN_PORT")?,
            user: var_os("WG_GREMLIN_USER").map(|osstr| osstr.to_string_lossy().into_owned()),
            pass: var_os("WG_GREMLIN_PASS").map(|osstr| osstr.to_string_lossy().into_owned()),
            accept_invalid_certs: env_bool("WG_GREMLIN_CERT")?,
            use_tls: env_bool("WG_GREMLIN_USE_TLS").unwrap_or(true),
            read_host: env_string("WG_NEPTUNE_READ_REPLICAS")?,
            pool_size: env_u16("WG_POOL_SIZE")
                .unwrap_or_else(|_| num_cpus::get().try_into().unwrap_or(8)),
        })
    }
/// Reads a set of environment variables to construct a [`NeptuneEndpoint`]. The environment
/// variables are as follows
///
/// * WG_GREMLIN_HOST - the hostname for the Gremlin-based DB. For example, `localhost`.
/// * WG_GREMLIN_PORT - the port number for the Gremlin-based DB. For example, `443`.
/// * WG_GREMLIN_USE_TLS - true if Warpgrapher should use TLS to connect to gremlin endpoint.
/// * WG_GREMLIN_CERT - true if Warpgrapher should accept an invalid cert. This could be
/// necessary in a test environment, but it should be set to false in production environments.
/// * WG_NEPTUNE_READ_REPLICAS - hostname for the Neptune read replicas
/// * WG_POOL_SIZE - connection pool size
///
/// The accept_invalid_certs option may be set to true in a test environment, where a test
/// Gremlin server is running with an invalid cert. It should be set to false in production
/// environments.
///
/// [`NeptuneEndpoint`]: ./struct.NeptuneEndpoint.html
///
/// # Errors
///
/// * [`EnvironmentVariableNotFound`] - if an environment variable does not exist
/// * [`EnvironmentVariableParseError`] - if an environment variable has the wrong type,
/// typically meaning that the WG_GREMLIN_PORT variable cannot be parsed from a string into an
/// integer
///
/// [`EnvironmentVariableNotFound`]: ../../enum.ErrorKind.html
/// [`EnvironmentVariableParseError`]: ../../enum.ErrorKind.html
///
/// # Examples
///
/// ```rust,no_run
/// # use warpgrapher::engine::database::gremlin::NeptuneEndpoint;
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
///     let ge = NeptuneEndpoint::from_env()?;
/// #    Ok(())
/// # }
/// ```
Reads a set of environment variables to construct a [`NeptuneEndpoint`]. The environment
variables are as follows

the hostname for the Gremlin-based DB. For example, `localhost`.
WG_GREMLIN_PORT - the port number for the Gremlin-based DB.

The accept_invalid_certs option may be set to true in a test environment, where a test
Gremlin server is running with an invalid cert. It should be set to false in production
environments.


Reads a set of environment variables to construct a [ ` NeptuneEndpoint ` ] . The environment variables are as follows the hostname for the Gremlin - based DB . For example ` localhost ` . WG_GREMLIN_PORT - the port number for the Gremlin - based DB . The accept_invalid_certs option may be set to true in a test environment where a test Gremlin server is running with an invalid cert . It should be set to false in production environments .
pub fn from_env() -> Result<NeptuneEndpoint, Error> {
        Ok(NeptuneEndpoint {
            host: env_string("WG_GREMLIN_HOST")?,
            port: env_u16("WG_GREMLIN_PORT")?,
            user: var_os("WG_GREMLIN_USER").map(|osstr| osstr.to_string_lossy().into_owned()),
            pass: var_os("WG_GREMLIN_PASS").map(|osstr| osstr.to_string_lossy().into_owned()),
            accept_invalid_certs: env_bool("WG_GREMLIN_CERT")?,
            use_tls: env_bool("WG_GREMLIN_USE_TLS").unwrap_or(true),
            read_host: env_string("WG_NEPTUNE_READ_REPLICAS")?,
            pool_size: env_u16("WG_POOL_SIZE")
                .unwrap_or_else(|_| num_cpus::get().try_into().unwrap_or(8)),
        })
    }
pub fn from_env ( ) -> Result < NeptuneEndpoint , Error > { Ok ( NeptuneEndpoint { host : env_string ( " " ) ? , port : env_u16 ( " " ) ? , user : var_os ( " " ) . map ( | osstr | osstr . to_string_lossy ( ) . into_owned ( ) ) , pass : var_os ( " " ) . map ( | osstr | osstr . to_string_lossy ( ) . into_owned ( ) ) , accept_invalid_certs : env_bool ( " " ) ? , use_tls : env_bool ( " " ) . unwrap_or ( true ) , read_host : env_string ( " " ) ? , pool_size : env_u16 ( " " ) . unwrap_or_else ( | _ | num_cpus :: get ( ) . try_into ( ) . unwrap_or ( 8 ) ) , } ) }
Reads a set of environment variables to construct a [`NeptuneEndpoint`].
Reads a set of environment variables to construct a [ ` NeptuneEndpoint ` ] .
errors
[`EnvironmentVariableNotFound`] - if an environment variable does not exist
[`EnvironmentVariableParseError`] - if an environment variable has the wrong type,
typically meaning that the WG_GREMLIN_PORT variable cannot be parsed from a string into an
integer

[`EnvironmentVariableNotFound`]: ../../enum.ErrorKind.html
[`EnvironmentVariableParseError`]: ../../enum.ErrorKind.html
[ ` EnvironmentVariableNotFound ` ] - if an environment variable does not exist [ ` EnvironmentVariableParseError ` ] - if an environment variable has the wrong type typically meaning that the WG_GREMLIN_PORT variable cannot be parsed from a string into an integer [ ` EnvironmentVariableNotFound ` ] : .. / .. / enum . ErrorKind . html [ ` EnvironmentVariableParseError ` ] : .. / .. / enum . ErrorKind . html
examples
None
use warpgrapher::engine::database::gremlin::neptuneendpoint;
None
fn main() -> result<(), box<dyn std::error::error>> {
let ge = NeptuneEndpoint::from_env()?.
let ge = NeptuneEndpoint :: from_env () ? .
ok(())
None
}
None