[−][src]Struct kubos_service::Config
KubOS config used by either Apps or Services. KubOS config files use the TOML format, and can may contain multiple named Categories. Typically each category corresponds to an App or Service name. This allows one config file to store configuration for multiple Apps / Services at a time.
Example KubOS config files for a Service called my-service
with an IP/port binding
[my-service]
my-property = "value"
[my-service.addr]
ip = 0.0.0.0
port = 8181
Methods
impl Config
[src]
pub fn new(name: &str) -> Result<Config, Error>
[src]
Creates and parses configuration data from the system configuration file or the path passed as the '-c' or '--config' option to this executable.
Arguments
name
- Category name used as a key in the config file
pub fn new_from_path(name: &str, path: String) -> Result<Config, Error>
[src]
Creates and parses configuration data from the passed in configuration path.
Arguments
name
- Category name used as a key in the config file
path
- Path to configuration file
pub fn new_from_str(name: &str, config: &str) -> Result<Config, Error>
[src]
Creates and parses configuration data from the passed in configuration string.
Arguments
name
- Category name used as a key in the config
config
- Config data as a string
pub fn hosturl(&self) -> Option<String>
[src]
Returns the configured hosturl string in the following format (using IPv4 addresses) - 0.0.0.0:0000
pub fn raw(&self) -> Value
[src]
Returns the category's configuration information
in the toml::Value
format.
This will contain the ip/port if provided, along with any other
configuration information found in the config file.
Examples
use kubos_system::Config; let config = Config::new("example-service").unwrap(); let raw = config.raw(); let bus = raw["bus"].as_str();
pub fn get(&self, key: &str) -> Option<Value>
[src]
Trait Implementations
Auto Trait Implementations
impl Send for Config
impl Unpin for Config
impl Sync for Config
impl UnwindSafe for Config
impl RefUnwindSafe for Config
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,