[−][src]Struct kubos_app::ServiceConfig
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
When addr
, addr.ip
, or addr.port
are not provided in the config file, the default IP
"127.0.0.1"
and default port 8080
are used instead.
Methods
impl Config
[src]
impl Config
pub fn new(name: &str) -> Config
[src]
pub fn new(name: &str) -> Config
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) -> Config
[src]
pub fn new_from_path(name: &str, path: String) -> Config
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) -> Config
[src]
pub fn new_from_str(name: &str, config: &str) -> Config
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) -> String
[src]
pub fn hosturl(&self) -> String
Returns the configured hosturl string in the following format (using IPv4 addresses) - 0.0.0.0:0000
pub fn raw(&self) -> Value
[src]
pub fn raw(&self) -> Value
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"); let raw = config.raw(); let bus = raw["bus"].as_str();
pub fn get(&self, key: &str) -> Option<Value>
[src]
pub fn get(&self, key: &str) -> Option<Value>
Trait Implementations
impl Clone for Config
[src]
impl Clone for Config
fn clone(&self) -> Config
[src]
fn clone(&self) -> Config
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Config
[src]
impl Default for Config
impl Debug for Config
[src]
impl Debug for Config
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
impl<T> CloneAny for T where
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Send + Sync> where
T: Send + Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Send + Sync> where
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,