style: cargo fmt
This commit is contained in:
parent
96250864af
commit
bebad3be9b
5 changed files with 14 additions and 15 deletions
|
@ -1,8 +1,7 @@
|
||||||
use actix_web::{web, Scope};
|
use actix_web::{Scope, web};
|
||||||
|
|
||||||
mod stats;
|
mod stats;
|
||||||
|
|
||||||
pub fn web() -> Scope {
|
pub fn web() -> Scope {
|
||||||
web::scope("/v1")
|
web::scope("/v1").service(stats::res)
|
||||||
.service(stats::res)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use actix_web::{get, web, HttpResponse, Responder};
|
use actix_web::{HttpResponse, Responder, get, web};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::Data;
|
use crate::Data;
|
||||||
|
@ -19,7 +19,10 @@ struct Response {
|
||||||
pub async fn res(data: web::Data<Data>) -> impl Responder {
|
pub async fn res(data: web::Data<Data>) -> impl Responder {
|
||||||
let response = Response {
|
let response = Response {
|
||||||
accounts: 0,
|
accounts: 0,
|
||||||
uptime: SystemTime::now().duration_since(data.start_time).expect("Seriously why dont you have time??").as_secs(),
|
uptime: SystemTime::now()
|
||||||
|
.duration_since(data.start_time)
|
||||||
|
.expect("Seriously why dont you have time??")
|
||||||
|
.as_secs(),
|
||||||
version: String::from(VERSION.unwrap_or("UNKNOWN")),
|
version: String::from(VERSION.unwrap_or("UNKNOWN")),
|
||||||
build_number: String::from("how do i implement this?"),
|
build_number: String::from("how do i implement this?"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use actix_web::{get, HttpResponse, Responder};
|
use actix_web::{HttpResponse, Responder, get};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
@ -14,9 +14,7 @@ struct UnstableFeatures;
|
||||||
pub async fn res() -> impl Responder {
|
pub async fn res() -> impl Responder {
|
||||||
let response = Response {
|
let response = Response {
|
||||||
unstable_features: UnstableFeatures,
|
unstable_features: UnstableFeatures,
|
||||||
versions: vec![
|
versions: vec![String::from("1")],
|
||||||
String::from("1"),
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok().json(response)
|
HttpResponse::Ok().json(response)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
use crate::Error;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio::fs::read_to_string;
|
use tokio::fs::read_to_string;
|
||||||
use crate::Error;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct ConfigBuilder {
|
pub struct ConfigBuilder {
|
||||||
|
@ -14,7 +14,7 @@ pub struct Database {
|
||||||
password: String,
|
password: String,
|
||||||
hostname: String,
|
hostname: String,
|
||||||
database: String,
|
database: String,
|
||||||
port: u16
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
@ -34,18 +34,17 @@ impl ConfigBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(self) -> Config {
|
pub fn build(self) -> Config {
|
||||||
|
|
||||||
let web = if let Some(web) = self.web {
|
let web = if let Some(web) = self.web {
|
||||||
Web {
|
Web {
|
||||||
url: web.url.unwrap_or(String::from("0.0.0.0")),
|
url: web.url.unwrap_or(String::from("0.0.0.0")),
|
||||||
port: web.port.unwrap_or(8080),
|
port: web.port.unwrap_or(8080),
|
||||||
ssl: web.ssl.unwrap_or_default()
|
ssl: web.ssl.unwrap_or_default(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Web {
|
Web {
|
||||||
url: String::from("0.0.0.0"),
|
url: String::from("0.0.0.0"),
|
||||||
port: 8080,
|
port: 8080,
|
||||||
ssl: false
|
ssl: false,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
use actix_web::{App, HttpServer, web};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use actix_web::{web, App, HttpServer};
|
|
||||||
mod config;
|
mod config;
|
||||||
use config::{Config, ConfigBuilder};
|
use config::{Config, ConfigBuilder};
|
||||||
mod api;
|
mod api;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue