Skip to main content

BhtuneConfig

Struct BhtuneConfig 

Source
pub struct BhtuneConfig {
Show 13 fields pub server_mode: Option<ServerMode>, pub demo: DemoPolicyConfig, pub db: Option<PathBuf>, pub bridge_host: Option<String>, pub server: Option<String>, pub templates: Option<PathBuf>, pub bind: Option<String>, pub origin: Option<String>, pub trusted_proxy: Option<String>, pub retention_days: Option<u32>, pub allow_uncertain_quality: bool, pub tuning: TuningConfig, pub log: LogConfig,
}
Expand description

bhtune’s configuration, loaded from an optional TOML file. Every field is optional; a value missing from the file (or the file itself missing) falls back to the env var / CLI flag / built-in default resolution in the resolve_* functions below.

Fields§

§server_mode: Option<ServerMode>

Runtime server mode. The environment variable BHTUNE_SERVER_MODE overrides this.

§demo: DemoPolicyConfig

Safety limits for the simulator-only public demo mode.

§db: Option<PathBuf>

Overrides the default SQLite database path (see [default_db_path_from]).

§bridge_host: Option<String>

Overrides DEFAULT_BRIDGE_HOST for every tune --driver opcda and opc subcommand invocation that doesn’t pass --bridge-host explicitly.

§server: Option<String>

Default OPC DA server ProgID, used when --server is omitted. Unlike the other fields there is no built-in default – if this is unset and --server is omitted, the command errors (see [resolve_server]).

§templates: Option<PathBuf>

Overrides the default user-supplied DCS/PLC template catalog path (see [templates_path_from]). A file here is loaded on every startup in addition to the embedded built-in catalog (see crate::db::open and [load_user_templates]), attributed TemplateOrigin::Catalog.

§bind: Option<String>

Overrides DEFAULT_BIND_ADDR – the host:port bhtune-server listens on. Only meaningful to the server binary; see [resolve_bind_addr].

§origin: Option<String>

Optional exact browser origin for state-changing HTTP requests. BHTUNE_ORIGIN overrides this value. Full mode automatically matches the browser origin to the request host when this is unset; set it for a reverse proxy that rewrites Host or to pin one public origin. Demo mode always requires an exact configured origin and requires HTTPS, except for explicit loopback HTTP origins used by local tests and development.

§trusted_proxy: Option<String>

IP address or matching-family CIDR of a reverse proxy trusted to supply the single-address X-BHTune-Client-IP header for Demo quota accounting.

§retention_days: Option<u32>

Age-based history retention (history-retention): tune runs with started_at older than this many days are deleted automatically on every startup (both binaries, via crate::db::open) and, for bhtune-server, again on a periodic timer while it keeps running – see crate::retention. A present value must be at least 1. None (the default) means retain forever: there is no built-in number of days, since at this project’s data volumes (see AGENTS.md’s History explorer notes) an unexpected auto-delete of someone’s baseline tune is a worse failure mode than an ever-growing database file. See [resolve_retention_days].

§allow_uncertain_quality: bool

Default OPC sample-quality policy for the server config page: true accepts Uncertain quality, while false rejects it. A missing key is treated as true when the config file is parsed, matching the configuration-page default rather than bool’s ordinary false.

§tuning: TuningConfig

Global tune timing defaults. Missing keys remain None and resolve through [resolve_tuning_config] only when a tune is prepared.

§log: LogConfig

[log] sub-table: level/directory/format/rotation for crate::logging’s tracing setup, mirroring opcda-bridge-gateway’s own log.* config conventions.

Trait Implementations§

Source§

impl Clone for BhtuneConfig

Source§

fn clone(&self) -> BhtuneConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BhtuneConfig

Source§

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

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

impl Default for BhtuneConfig

Source§

fn default() -> BhtuneConfig

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

impl<'de> Deserialize<'de> for BhtuneConfig

Source§

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

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

impl Eq for BhtuneConfig

Source§

impl JsonSchema for BhtuneConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for BhtuneConfig

Source§

fn eq(&self, other: &BhtuneConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for BhtuneConfig

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for BhtuneConfig

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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