1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#[cfg(feature = "libos")]
fn main() {
let env = env_logger::Env::new()
.filter_or("TEACLAVE_LOG", "RUST_LOG")
.write_style_or("TEACLAVE_LOG_STYLE", "RUST_LOG_STYLE");
let env_logger = env_logger::Builder::from_env(env).build();
teaclave_logger::Builder::new()
.secondary_logger(env_logger)
.init();
let config_path = "runtime.config.toml";
let config = teaclave_config::RuntimeConfig::from_toml(config_path)
.expect("Failed to load config file.");
let result = tokio::runtime::Builder::new_multi_thread()
.worker_threads(8)
.enable_all()
.build()
.expect("failed to create tokio runtime")
.block_on(teaclave_execution_service_enclave::start_service(&config));
if result.is_err() {
log::error!("app will exit, error {:?}", result);
}
}
#[cfg(not(feature = "libos"))]
fn main() -> anyhow::Result<()> {
pub use teaclave_file_agent::ocall_handle_file_request;
const PACKAGE_NAME: &str = env!("CARGO_PKG_NAME");
teaclave_service_app_utils::launch_teaclave_service(PACKAGE_NAME)
}