Skip to main content

ServerConfig

Struct ServerConfig 

Source
pub struct ServerConfig {
Show 17 fields pub environment: String, pub root_path: String, pub network: Network, pub logging: Logging, pub certificate: Option<Certificate>, pub compression: Option<Compression>, pub command_control: Option<Value>, pub security: Option<Value>, pub oidc: Option<Value>, pub store: Option<Value>, pub authentication: Option<Value>, pub content: Option<Value>, pub proxy: Option<Value>, pub browser: Option<Value>, pub crawler: Option<Value>, pub vpn: Option<Value>, pub connectors: Option<BTreeMap<String, Value>>,
}
Expand description

Main configuration structure for Product OS Server

This structure contains all configuration options for running a Product OS server instance, including network settings, security, authentication, data stores, and more.

Individual domain crates own their own config types. This struct composes them for the server’s top-level configuration.

Fields§

§environment: String

Environment name (e.g., “development”, “production”)

§root_path: String

Root path for the server

§network: Network

Network configuration

§logging: Logging

Logging configuration

§certificate: Option<Certificate>

TLS/SSL certificate configuration

§compression: Option<Compression>

Compression configuration

§command_control: Option<Value>

Command and control configuration (raw JSON, parsed by product-os-command-control)

§security: Option<Value>

Security configuration (raw JSON, parsed by product-os-security)

§oidc: Option<Value>

OIDC configuration

§store: Option<Value>

Data store configurations (raw JSON, parsed by product-os-store)

§authentication: Option<Value>

Authentication configuration (raw JSON, parsed by product-os-authentication)

§content: Option<Value>

Content server configuration (raw JSON, parsed by product-os-content-setup)

§proxy: Option<Value>

Network proxy configuration (raw JSON, parsed by product-os-proxy)

§browser: Option<Value>

Browser configuration (raw JSON, parsed by product-os-browser)

§crawler: Option<Value>

Web crawler configuration (raw JSON, parsed by product-os-crawler)

§vpn: Option<Value>

VPN configuration (raw JSON, parsed by product-os-vpn)

§connectors: Option<BTreeMap<String, Value>>

API connector definitions (raw JSON)

Implementations§

Source§

impl ServerConfig

Source

pub fn new() -> Self

Create a new ServerConfig with default development settings

Source

pub fn environment(&self) -> &str

Get the environment name

Source

pub fn get_host(&self) -> String

Get the configured hostname

Source

pub fn url_address(&self) -> Url

👎Deprecated since 0.0.53: Use try_url_address which returns Result instead of panicking

Build the complete URL address from configuration

§Panics

Panics if the URL cannot be parsed. Use try_url_address for a non-panicking alternative.

Source

pub fn try_url_address(&self) -> Result<Url>

Build the complete URL address from configuration, returning an error if parsing fails.

§Errors

Returns ConfigurationError if the URL cannot be parsed from the configured protocol, host, port, and root path.

Source

pub fn socket_address(&self, port: Option<u16>, default_all: bool) -> SocketAddr

Get socket address for binding

Source

pub fn get_socket_address( host: &str, port: u16, default_all: bool, ) -> SocketAddr

Create socket address from components

Source

pub fn is_secure(&self) -> bool

Check if secure mode is enabled

Source

pub fn all_insecure(&self) -> bool

Check if insecure connections are allowed

Source

pub fn insecure_port(&self) -> u16

Get insecure port number

Source

pub fn insecure_force_secure(&self) -> bool

Check if insecure connections should force redirect to secure

Source

pub fn is_compression_gzip(&self) -> bool

Check if gzip compression is enabled

Source

pub fn is_compression_deflate(&self) -> bool

Check if deflate compression is enabled

Source

pub fn is_compression_brotli(&self) -> bool

Check if brotli compression is enabled

Trait Implementations§

Source§

impl Clone for ServerConfig

Source§

fn clone(&self) -> ServerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ServerConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl ProductOSConfig for ServerConfig

Source§

const SECTION_KEY: &'static str = "server"

The key name used when this config appears as a section in a unified config file (e.g., “browser”, “store”, “network”).
Source§

fn validate(&self) -> Result<(), ConfigError>

Validate the configuration, returning errors if invalid. Read more
Source§

impl Serialize for ServerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CastSlice<'_, T> for T

Source§

fn cast_slice(selves: &[T]) -> &[T]

Source§

impl<T> CastSliceMut<'_, T> for T

Source§

fn cast_slice_mut(selves: &mut [T]) -> &mut [T]

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,