pub struct BootstrapConfig { /* private fields */ }Expand description
Environment-driven bootstrap settings for Spring Cloud Config Server.
This is intended for real service startup paths where configuration should be loaded from environment variables instead of hard-coded values.
Implementations§
Source§impl BootstrapConfig
impl BootstrapConfig
Sourcepub const SERVER_URL_ENV: &'static str = "SPRING_CONFIG_SERVER_URL"
pub const SERVER_URL_ENV: &'static str = "SPRING_CONFIG_SERVER_URL"
Environment variable used for the Config Server base URL.
Sourcepub const APPLICATION_ENV: &'static str = "SPRING_APPLICATION_NAME"
pub const APPLICATION_ENV: &'static str = "SPRING_APPLICATION_NAME"
Environment variable used for the application name.
Sourcepub const PROFILES_ENV: &'static str = "SPRING_PROFILES_ACTIVE"
pub const PROFILES_ENV: &'static str = "SPRING_PROFILES_ACTIVE"
Environment variable used for the active profile list.
Sourcepub const LABEL_ENV: &'static str = "SPRING_CONFIG_LABEL"
pub const LABEL_ENV: &'static str = "SPRING_CONFIG_LABEL"
Environment variable used for the config label.
Sourcepub const USERNAME_ENV: &'static str = "SPRING_CONFIG_USERNAME"
pub const USERNAME_ENV: &'static str = "SPRING_CONFIG_USERNAME"
Environment variable used for the Config Server username.
Sourcepub const PASSWORD_ENV: &'static str = "SPRING_CONFIG_PASSWORD"
pub const PASSWORD_ENV: &'static str = "SPRING_CONFIG_PASSWORD"
Environment variable used for the Config Server password.
Sourcepub const BEARER_TOKEN_ENV: &'static str = "SPRING_CONFIG_BEARER_TOKEN"
pub const BEARER_TOKEN_ENV: &'static str = "SPRING_CONFIG_BEARER_TOKEN"
Environment variable used for a Config Server bearer token.
Sourcepub const INSECURE_TLS_ENV: &'static str = "SPRING_CONFIG_INSECURE_TLS"
pub const INSECURE_TLS_ENV: &'static str = "SPRING_CONFIG_INSECURE_TLS"
Environment variable used to disable TLS certificate and hostname validation.
Sourcepub const TIMEOUT_SECONDS_ENV: &'static str = "SPRING_CONFIG_TIMEOUT_SECS"
pub const TIMEOUT_SECONDS_ENV: &'static str = "SPRING_CONFIG_TIMEOUT_SECS"
Environment variable used for request timeout in seconds.
Sourcepub fn new<A, S, I, P>(
server_url: A,
application: S,
profiles: I,
) -> Result<Self>
pub fn new<A, S, I, P>( server_url: A, application: S, profiles: I, ) -> Result<Self>
Creates a bootstrap configuration explicitly.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Builds a bootstrap configuration from environment variables.
Required:
SPRING_CONFIG_SERVER_URLSPRING_APPLICATION_NAME
Optional:
SPRING_PROFILES_ACTIVEdefaults todefaultSPRING_CONFIG_LABELSPRING_CONFIG_USERNAMESPRING_CONFIG_PASSWORDSPRING_CONFIG_BEARER_TOKENSPRING_CONFIG_INSECURE_TLSSPRING_CONFIG_TIMEOUT_SECS
Sourcepub fn basic_auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn basic_auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Sets HTTP Basic authentication.
Sourcepub fn bearer_auth(self, token: impl Into<String>) -> Self
pub fn bearer_auth(self, token: impl Into<String>) -> Self
Sets Bearer token authentication.
Sourcepub fn danger_accept_invalid_tls(self, enabled: bool) -> Self
pub fn danger_accept_invalid_tls(self, enabled: bool) -> Self
Disables both TLS certificate and hostname validation for Config Server requests.
This should only be enabled for development or controlled test environments.
Sourcepub fn server_url(&self) -> &str
pub fn server_url(&self) -> &str
Returns the Config Server base URL.
Sourcepub fn application(&self) -> &str
pub fn application(&self) -> &str
Returns the Spring application name.
Sourcepub fn build_client(&self) -> Result<SpringConfigClient>
pub fn build_client(&self) -> Result<SpringConfigClient>
Builds a SpringConfigClient from the bootstrap settings.
Sourcepub fn environment_request(&self) -> Result<EnvironmentRequest>
pub fn environment_request(&self) -> Result<EnvironmentRequest>
Builds an EnvironmentRequest from the bootstrap settings.
Sourcepub async fn load_environment(&self) -> Result<Environment>
pub async fn load_environment(&self) -> Result<Environment>
Loads the raw Spring Environment.
Sourcepub async fn load_typed<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub async fn load_typed<T>(&self) -> Result<T>where
T: DeserializeOwned,
Loads typed configuration directly from Spring Config Server.
Trait Implementations§
Source§impl Clone for BootstrapConfig
impl Clone for BootstrapConfig
Source§fn clone(&self) -> BootstrapConfig
fn clone(&self) -> BootstrapConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BootstrapConfig
impl Debug for BootstrapConfig
Source§impl PartialEq for BootstrapConfig
impl PartialEq for BootstrapConfig
impl Eq for BootstrapConfig
impl StructuralPartialEq for BootstrapConfig
Auto Trait Implementations§
impl Freeze for BootstrapConfig
impl RefUnwindSafe for BootstrapConfig
impl Send for BootstrapConfig
impl Sync for BootstrapConfig
impl Unpin for BootstrapConfig
impl UnsafeUnpin for BootstrapConfig
impl UnwindSafe for BootstrapConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.