feat: add server cli configuration
This commit is contained in:
parent
143dc0e5ce
commit
f9fb8f0670
4 changed files with 234 additions and 15 deletions
|
|
@ -1,3 +1,7 @@
|
|||
mod config;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
use clap::Parser;
|
||||
use proto::handshake::response::HandshakeResponse;
|
||||
use proto::handshake::server::do_server_handshake;
|
||||
use proto::message::backend::{
|
||||
|
|
@ -11,10 +15,13 @@ use proto::writer::backend::BackendProtoWriter;
|
|||
use proto::writer::protowriter::{ProtoFlush, ProtoWriter};
|
||||
use tokio::io::{BufReader, BufWriter};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use crate::config::Configuration;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let addr = "0.0.0.0:5432";
|
||||
let config = Configuration::parse();
|
||||
|
||||
let addr = config.get_socket_address();
|
||||
let listener = TcpListener::bind(&addr).await?;
|
||||
println!("Server started at {addr}");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue