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: DemoPolicyConfigSafety 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>Exact browser origin allowed for state-changing HTTP requests. BHTUNE_ORIGIN
overrides this value. Demo mode 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: boolDefault 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: TuningConfigGlobal 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
impl Clone for BhtuneConfig
Source§fn clone(&self) -> BhtuneConfig
fn clone(&self) -> BhtuneConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BhtuneConfig
impl Debug for BhtuneConfig
Source§impl Default for BhtuneConfig
impl Default for BhtuneConfig
Source§impl<'de> Deserialize<'de> for BhtuneConfig
impl<'de> Deserialize<'de> for BhtuneConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BhtuneConfig
Source§impl JsonSchema for BhtuneConfig
impl JsonSchema for BhtuneConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for BhtuneConfig
impl PartialEq for BhtuneConfig
Source§fn eq(&self, other: &BhtuneConfig) -> bool
fn eq(&self, other: &BhtuneConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BhtuneConfig
impl Serialize for BhtuneConfig
impl StructuralPartialEq for BhtuneConfig
Auto Trait Implementations§
impl Freeze for BhtuneConfig
impl RefUnwindSafe for BhtuneConfig
impl Send for BhtuneConfig
impl Sync for BhtuneConfig
impl Unpin for BhtuneConfig
impl UnsafeUnpin for BhtuneConfig
impl UnwindSafe for BhtuneConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].