feat: Add CI/CD pipeline for release deployment and make server host/port configurable via environment variables.
Some checks failed
/ upload (release) Failing after 3s
Some checks failed
/ upload (release) Failing after 3s
This commit is contained in:
parent
24e6ac26f1
commit
131b3cc82a
2 changed files with 31 additions and 3 deletions
|
|
@ -39,6 +39,8 @@ async fn main() {
|
|||
// OAuth configuration
|
||||
let client_id = dotenvy::var("CLIENT_ID").unwrap();
|
||||
let client_secret = dotenvy::var("CLIENT_SECRET").unwrap();
|
||||
let port = dotenvy::var("PORT").unwrap_or_else(|_| "3001".to_string());
|
||||
let host = dotenvy::var("HOST").unwrap_or_else(|_| "http://localhost:".to_string() + &port);
|
||||
// NOTE: In production, do not hardcode localhost
|
||||
let auth_url = AuthUrl::new("https://idm.flegr.me/application/o/authorize/".to_string())
|
||||
.expect("Invalid authorization endpoint URL");
|
||||
|
|
@ -52,7 +54,7 @@ async fn main() {
|
|||
Some(token_url),
|
||||
)
|
||||
.set_redirect_uri(
|
||||
RedirectUrl::new("http://localhost:3001/auth/callback".to_string())
|
||||
RedirectUrl::new(host + "/auth/callback")
|
||||
.expect("Invalid redirect URL"),
|
||||
);
|
||||
|
||||
|
|
@ -79,8 +81,9 @@ async fn main() {
|
|||
.with_state(app_state);
|
||||
|
||||
// Run the app
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3001").await.unwrap();
|
||||
println!("Chat server listening on http://0.0.0.0:3001");
|
||||
let port = dotenvy::var("PORT").unwrap_or_else(|_| "3001".to_string());
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:".to_string() + &port).await.unwrap();
|
||||
println!("Chat server listening on http://0.0.0.0:{}", port);
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue