added cli parameter to toggle registraion, and split the monorepo: now this is only the backend
This commit is contained in:
@@ -25,6 +25,7 @@ mod routes;
|
||||
|
||||
pub struct AppConfig {
|
||||
pub avatar_dir: PathBuf,
|
||||
pub prohibit_registration: bool,
|
||||
}
|
||||
|
||||
#[derive(clap::Parser, Debug)]
|
||||
@@ -39,9 +40,13 @@ pub struct Cli {
|
||||
database: String,
|
||||
|
||||
/// Data directory path
|
||||
#[arg(short = 'D', long, default_value = "/var/lib/chatapp")]
|
||||
#[arg(short = 'D', long, default_value = "/var/lib/frangipane")]
|
||||
data_dir: String,
|
||||
|
||||
/// Whether to disable user registration
|
||||
#[arg(short, long)]
|
||||
no_registration: bool,
|
||||
|
||||
/// Verbose mode
|
||||
#[arg(short, long)]
|
||||
verbose: bool,
|
||||
@@ -86,6 +91,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
let data_dir = PathBuf::from(cli.data_dir);
|
||||
let config = Arc::new(AppConfig {
|
||||
avatar_dir: data_dir.join("avatars"),
|
||||
prohibit_registration: cli.no_registration,
|
||||
});
|
||||
|
||||
let mut app = Router::new()
|
||||
|
||||
Reference in New Issue
Block a user