2024-02-09 21:22:29 +01:00
|
|
|
/*
|
|
|
|
factoriauth - An unofficial authentication server for Factorio
|
|
|
|
Copyright (C) 2024 lambda@xiretza.xyz
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-02-10 10:20:44 +01:00
|
|
|
#![warn(clippy::pedantic, clippy::as_conversions)]
|
|
|
|
#![forbid(unsafe_code)]
|
|
|
|
|
2024-02-10 10:51:56 +01:00
|
|
|
mod auth;
|
|
|
|
|
2024-02-10 11:04:10 +01:00
|
|
|
use axum::{routing::get, Router};
|
2024-02-10 10:53:28 +01:00
|
|
|
use color_eyre::Result;
|
|
|
|
use tracing::{event, instrument, Level};
|
|
|
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
|
|
|
|
|
|
|
#[instrument]
|
|
|
|
fn init() -> Result<()> {
|
|
|
|
color_eyre::install()?;
|
|
|
|
|
|
|
|
let filter_layer = EnvFilter::try_from_default_env()
|
|
|
|
.or_else(|_| EnvFilter::try_new("info"))
|
|
|
|
.unwrap();
|
|
|
|
let fmt_layer = tracing_subscriber::fmt::layer().with_target(true);
|
|
|
|
|
|
|
|
tracing_subscriber::registry()
|
|
|
|
.with(filter_layer)
|
|
|
|
.with(fmt_layer)
|
|
|
|
.init();
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
#[instrument]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
init()?;
|
|
|
|
|
|
|
|
event!(Level::INFO, "Hello, world!");
|
|
|
|
|
2024-02-10 11:04:10 +01:00
|
|
|
let app = Router::new().route("/tls-check/success", get(|| async { "OK" }));
|
|
|
|
let listener = tokio::net::TcpListener::bind("[::]:8080").await?;
|
|
|
|
axum::serve(listener, app).await?;
|
|
|
|
|
2024-02-10 10:53:28 +01:00
|
|
|
Ok(())
|
2024-02-09 21:22:29 +01:00
|
|
|
}
|