-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[integritee-service] introduce getters for RunConfig
and make fields private
#1349
Changes from all commits
640df03
5f5e887
fcfe368
4607271
48c538c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
|
||
use clap::ArgMatches; | ||
use itc_rest_client::rest_client::Url; | ||
use itp_settings::teeracle::DEFAULT_MARKET_DATA_UPDATE_INTERVAL; | ||
use parse_duration::parse; | ||
use serde::{Deserialize, Serialize}; | ||
use std::{ | ||
|
@@ -215,17 +216,46 @@ impl From<&ArgMatches<'_>> for Config { | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct RunConfig { | ||
/// Skip remote attestation. Set this flag if running enclave in SW mode | ||
pub skip_ra: bool, | ||
skip_ra: bool, | ||
/// Set this flag if running in development mode to bootstrap enclave account on parentchain via //Alice. | ||
pub dev: bool, | ||
dev: bool, | ||
/// Request key and state provisioning from a peer worker. | ||
pub request_state: bool, | ||
request_state: bool, | ||
/// Shard identifier base58 encoded. Defines the shard that this worker operates on. Default is mrenclave. | ||
pub shard: Option<String>, | ||
shard: Option<String>, | ||
/// Optional teeracle update interval | ||
pub teeracle_update_interval: Option<Duration>, | ||
teeracle_update_interval: Option<Duration>, | ||
/// Marblerun's Prometheus endpoint base URL | ||
pub marblerun_base_url: Option<String>, | ||
marblerun_base_url: Option<String>, | ||
} | ||
|
||
impl RunConfig { | ||
pub fn skip_ra(&self) -> bool { | ||
self.skip_ra | ||
} | ||
|
||
pub fn dev(&self) -> bool { | ||
self.dev | ||
} | ||
|
||
pub fn request_state(&self) -> bool { | ||
self.request_state | ||
} | ||
|
||
pub fn shard(&self) -> Option<&str> { | ||
self.shard.as_deref() | ||
} | ||
|
||
pub fn teeracle_update_interval(&self) -> Duration { | ||
self.teeracle_update_interval.unwrap_or(DEFAULT_MARKET_DATA_UPDATE_INTERVAL) | ||
} | ||
|
||
pub fn marblerun_base_url(&self) -> &str { | ||
// This conflicts with the default port of a substrate node, but it is indeed the | ||
// default port of marblerun too: | ||
// https://github.com/edgelesssys/marblerun/blob/master/docs/docs/workflows/monitoring.md?plain=1#L26 | ||
self.marblerun_base_url.as_deref().unwrap_or("http://localhost:9944") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the default that was used, but it does not make sense to me because this is also the default port of a substrate node. @OverOrion is this really the default port that the marblerun uses? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright thanks! added it as a comment: 48c538c |
||
} | ||
} | ||
|
||
impl From<&ArgMatches<'_>> for RunConfig { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real benefit of the compiler flag here, and this removes the need to use this compiler flag in the runconfig.