68 lines
2.0 KiB
Rust
68 lines
2.0 KiB
Rust
// dead rust-lang/rustfmt/pull/5394 :(
|
|
#![feature(
|
|
decl_macro,
|
|
duration_constructors,
|
|
never_type,
|
|
once_cell_try,
|
|
seek_stream_len
|
|
)]
|
|
#![allow(clippy::future_not_send)] // will get to fix these later
|
|
|
|
//! # About, Licensing and More
|
|
//!
|
|
//! Check the README.md for entry-level documentation.
|
|
//!
|
|
//! # Where is my documentation?
|
|
//!
|
|
//! For ease of development and centralized **corrent** information, this codebase will serve both
|
|
//! as project documentation AND documentation for the behavior of the OpenID Connect server.
|
|
//!
|
|
//! Might be hard to figure out how the program behaves based on the code, but I will try to put
|
|
//! behavior parameters in [`consts`], so that might be a good starting point to know some stuff
|
|
//! (e.g. profile profile picture search path).
|
|
//!
|
|
//! Checking out [`conf`] might be useful too to know what could've been configured by server
|
|
//! administrators and less likely but maybe there can also be certain parameters in [`args`].
|
|
//!
|
|
//! I will try to keep those 3 modules as documented as possible, please feel free to open any
|
|
//! issues/PRs regarding information in there.
|
|
|
|
use std::fs::File;
|
|
|
|
use clap::Parser;
|
|
|
|
use crate::ext::FileExt as _;
|
|
|
|
pub mod args;
|
|
pub mod auth;
|
|
pub mod conf;
|
|
pub mod consts;
|
|
pub mod ext;
|
|
pub mod serdes;
|
|
pub mod server;
|
|
pub mod utils;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let args = args::Args::parse();
|
|
#[cfg(feature = "log")]
|
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
|
let conf = if let Some(conf) = File::try_open(&args.conf) {
|
|
conf::Config::from_toml_file(&mut conf?)?
|
|
} else {
|
|
println!(
|
|
"\x1b[30;43mWRN\x1b[0m: \x1b[35m{:?}\x1b[0m not found, using default configuration",
|
|
args.conf.display()
|
|
);
|
|
conf::Config::default()
|
|
};
|
|
|
|
// o tsukare su-mmer, awaaai yumeniii shiii oooo-tome, wa, hitoshireeeezu, cryyyyying
|
|
// (idek japanese but im vibing)
|
|
println!("\n\x1b[1;3;4;33mConfiguration\x1b[0m: {conf:#?}\n");
|
|
|
|
server::start_app(args, conf).await?;
|
|
|
|
Ok(())
|
|
}
|