add listen port
This commit is contained in:
parent
3374110f38
commit
ab444e07f4
2 changed files with 5 additions and 2 deletions
|
@ -47,6 +47,7 @@ async fn main() {
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|v| v.parse().ok())
|
.and_then(|v| v.parse().ok())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let listen_port: String = env::var("PORT").ok().and_then(|v| v.parse().ok()).unwrap();
|
||||||
|
|
||||||
let db_pool = PgPoolOptions::new()
|
let db_pool = PgPoolOptions::new()
|
||||||
.max_connections(64)
|
.max_connections(64)
|
||||||
|
@ -66,8 +67,9 @@ async fn main() {
|
||||||
.route("/version", get(version))
|
.route("/version", get(version))
|
||||||
.with_state(db_pool);
|
.with_state(db_pool);
|
||||||
|
|
||||||
// run it with hyper on localhost:3003
|
let mut bind_with = "127.0.0.1:".to_owned();
|
||||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:3003")
|
bind_with += &listen_port;
|
||||||
|
let listener = tokio::net::TcpListener::bind(bind_with)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
|
|
|
@ -12,6 +12,7 @@ Group=users
|
||||||
WorkingDirectory=/home/myuser
|
WorkingDirectory=/home/myuser
|
||||||
ExecStart=/usr/local/bin/kosyncrs
|
ExecStart=/usr/local/bin/kosyncrs
|
||||||
Environment="PG_URL=postgresql://kosync:password@localhost/kosync"
|
Environment="PG_URL=postgresql://kosync:password@localhost/kosync"
|
||||||
|
Environment="PORT=3003"
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
Loading…
Reference in a new issue