mirror of https://github.com/zer0bin-dev/zer0bin
port and host values in config
This commit is contained in:
parent
d402e68c11
commit
d293e59d4d
|
@ -11,6 +11,7 @@ pub struct Config {
|
|||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct ServerConfig {
|
||||
pub backend_host: String,
|
||||
pub backend_port: u16,
|
||||
}
|
||||
|
||||
|
|
|
@ -136,9 +136,14 @@ async fn main() -> io::Result<()> {
|
|||
.await
|
||||
.expect("Failed to connect to database");
|
||||
|
||||
let address = format!(
|
||||
"{}:{}",
|
||||
config.server.backend_host, config.server.backend_port
|
||||
);
|
||||
|
||||
let state = AppState { config, pool };
|
||||
|
||||
println!("🚀 zer0bin is running");
|
||||
println!("🚀 zer0bin is running on {}", address);
|
||||
|
||||
HttpServer::new(move || {
|
||||
let cors = Cors::default()
|
||||
|
@ -153,7 +158,7 @@ async fn main() -> io::Result<()> {
|
|||
.app_data(Data::new(state.clone()))
|
||||
.service(web::scope("/p").service(get_paste).service(new_paste))
|
||||
})
|
||||
.bind("localhost:8000")?
|
||||
.bind(address)?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{
|
||||
"server": {
|
||||
"backend_host": "localhost",
|
||||
"backend_port": 8000
|
||||
},
|
||||
"pastes": {
|
||||
"character_limit": 40000,
|
||||
"days_til_expiration": 7
|
||||
|
|
Loading…
Reference in New Issue