pub struct DatastoreConfig {
pub host: String,
pub port: u16,
pub tls: bool,
}
Expand description
Configuration structure for the datastore.
This struct encapsulates the configuration details required to connect to the datastore, including the host address, port, and whether TLS is enabled.
Fields§
§host: String
Hostname or IP address of the datastore.
port: u16
Port number used to connect to the datastore.
tls: bool
Whether TLS is enabled for the datastore connection.
Implementations§
Source§impl DatastoreConfig
impl DatastoreConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Creates a new DatastoreConfig
instance by reading values from environment variables.
If the environment variables are not set or cannot be parsed, default values are used:
DATASTORE_HOST
defaults to"127.0.0.1"
.DATASTORE_PORT
defaults to6000
.DATASTORE_TLS
defaults tofalse
.
§Returns
A DatastoreConfig
instance with values derived from the environment or defaults.
Sourcepub fn new(host: String, port: u16, tls: bool) -> Self
pub fn new(host: String, port: u16, tls: bool) -> Self
Creates a new DatastoreConfig
instance with the provided values.
§Arguments
host
- AString
representing the hostname or IP address of the datastore.port
- Au16
representing the port number for connecting to the datastore.tls
- Abool
indicating whether to use TLS for the connection (true
for TLS,false
otherwise).
§Returns
A DatastoreConfig
instance initialized with the specified host, port, and TLS settings.
Trait Implementations§
Source§impl Clone for DatastoreConfig
impl Clone for DatastoreConfig
Source§fn clone(&self) -> DatastoreConfig
fn clone(&self) -> DatastoreConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DatastoreConfig
impl RefUnwindSafe for DatastoreConfig
impl Send for DatastoreConfig
impl Sync for DatastoreConfig
impl Unpin for DatastoreConfig
impl UnwindSafe for DatastoreConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request