aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-12-27 18:33:06 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-12-27 18:33:06 +0100
commitccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7 (patch)
tree985f9d136a981ec7cc43984c976c60e9295340d5 /src/main.rs
parent7744625c18aff5990a792bb13a44b60d8c4d4fc5 (diff)
downloadaerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.tar.gz
aerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.zip
add a --dev mode
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 3221c2e..3baa8e2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -29,7 +29,12 @@ struct Args {
#[clap(subcommand)]
command: Command,
+ /// A special mode dedicated to developers, NOT INTENDED FOR PRODUCTION
+ #[clap(long)]
+ dev: bool,
+
#[clap(short, long, env = "CONFIG_FILE", default_value = "aerogramme.toml")]
+ /// Path to the main Aerogramme configuration file
config_file: PathBuf,
}
@@ -158,7 +163,22 @@ async fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let args = Args::parse();
- let any_config = read_config(args.config_file)?;
+ let any_config = if args.dev {
+ use std::net::*;
+ AnyConfig::Provider(ProviderConfig {
+ pid: None,
+ imap: ImapConfig {
+ bind_addr: SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 1143),
+ },
+ lmtp: LmtpConfig {
+ bind_addr: SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), 1025),
+ hostname: "example.tld".to_string(),
+ },
+ users: UserManagement::Demo,
+ })
+ } else {
+ read_config(args.config_file)?
+ };
match (&args.command, any_config) {
(Command::Companion(subcommand), AnyConfig::Companion(config)) => match subcommand {
@@ -184,8 +204,8 @@ async fn main() -> Result<()> {
ProviderCommand::Account(cmd) => {
let user_file = match config.users {
UserManagement::Static(conf) => conf.user_list,
- UserManagement::Ldap(_) => {
- panic!("LDAP account management is not supported from Aerogramme.")
+ _ => {
+ panic!("Only static account management is supported from Aerogramme.")
}
};
account_management(&args.command, cmd, user_file)?;