mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Move all web pieces into WebConfig
This commit is contained in:
parent
d0f821add4
commit
81d232fac5
3 changed files with 8 additions and 5 deletions
|
|
@ -9,6 +9,8 @@ use web_util::json_response;
|
|||
pub struct WebConfig {
|
||||
pub port: u64,
|
||||
pub server_id: u64,
|
||||
pub project: Project,
|
||||
pub start_time: Instant,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
|
@ -22,7 +24,7 @@ struct ServerInfo<'a> {
|
|||
}
|
||||
|
||||
/// Start the Rojo web server and park our current thread.
|
||||
pub fn start(config: WebConfig, project: Project, start_time: Instant) {
|
||||
pub fn start(config: WebConfig) {
|
||||
let address = format!("localhost:{}", config.port);
|
||||
|
||||
let server_id = config.server_id.to_string();
|
||||
|
|
@ -33,7 +35,7 @@ pub fn start(config: WebConfig, project: Project, start_time: Instant) {
|
|||
// Get a summary of information about the server.
|
||||
|
||||
let current_time = {
|
||||
let elapsed = start_time.elapsed();
|
||||
let elapsed = config.start_time.elapsed();
|
||||
|
||||
elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1_000_000_000.0
|
||||
};
|
||||
|
|
@ -42,7 +44,7 @@ pub fn start(config: WebConfig, project: Project, start_time: Instant) {
|
|||
server_version: env!("CARGO_PKG_VERSION"),
|
||||
protocol_version: 1,
|
||||
server_id: &server_id,
|
||||
project: &project,
|
||||
project: &config.project,
|
||||
current_time,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue