|
@ -8,7 +8,7 @@ use acme_common::error::Error; |
|
|
use acme_common::logs::{set_log_system, DEFAULT_LOG_LEVEL};
|
|
|
use acme_common::logs::{set_log_system, DEFAULT_LOG_LEVEL};
|
|
|
use acme_common::{clean_pid_file, to_idna};
|
|
|
use acme_common::{clean_pid_file, to_idna};
|
|
|
use clap::builder::PossibleValuesParser;
|
|
|
use clap::builder::PossibleValuesParser;
|
|
|
use clap::{Arg, ArgMatches, Command};
|
|
|
|
|
|
|
|
|
use clap::{Arg, ArgAction, ArgMatches, Command};
|
|
|
use log::{debug, error, info};
|
|
|
use log::{debug, error, info};
|
|
|
use std::fs::File;
|
|
|
use std::fs::File;
|
|
|
use std::io::{self, Read};
|
|
|
use std::io::{self, Read};
|
|
@ -49,7 +49,7 @@ fn get_acme_value(cnf: &ArgMatches, opt: &str, opt_file: &str) -> Result<String, |
|
|
|
|
|
|
|
|
fn init(cnf: &ArgMatches) -> Result<(), Error> {
|
|
|
fn init(cnf: &ArgMatches) -> Result<(), Error> {
|
|
|
acme_common::init_server(
|
|
|
acme_common::init_server(
|
|
|
cnf.contains_id("foreground"),
|
|
|
|
|
|
|
|
|
cnf.get_flag("foreground"),
|
|
|
cnf.get_one::<String>("pid-file").map(|e| e.as_str()),
|
|
|
cnf.get_one::<String>("pid-file").map(|e| e.as_str()),
|
|
|
);
|
|
|
);
|
|
|
let domain = get_acme_value(cnf, "domain", "domain-file")?;
|
|
|
let domain = get_acme_value(cnf, "domain", "domain-file")?;
|
|
@ -161,19 +161,22 @@ fn main() { |
|
|
Arg::new("to-syslog")
|
|
|
Arg::new("to-syslog")
|
|
|
.long("log-syslog")
|
|
|
.long("log-syslog")
|
|
|
.help("Sends log messages via syslog")
|
|
|
.help("Sends log messages via syslog")
|
|
|
.conflicts_with("to-stderr"),
|
|
|
|
|
|
|
|
|
.conflicts_with("to-stderr")
|
|
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
)
|
|
|
)
|
|
|
.arg(
|
|
|
.arg(
|
|
|
Arg::new("to-stderr")
|
|
|
Arg::new("to-stderr")
|
|
|
.long("log-stderr")
|
|
|
.long("log-stderr")
|
|
|
.help("Prints log messages to the standard error output")
|
|
|
.help("Prints log messages to the standard error output")
|
|
|
.conflicts_with("to-syslog"),
|
|
|
|
|
|
|
|
|
.conflicts_with("to-syslog")
|
|
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
)
|
|
|
)
|
|
|
.arg(
|
|
|
.arg(
|
|
|
Arg::new("foreground")
|
|
|
Arg::new("foreground")
|
|
|
.long("foreground")
|
|
|
.long("foreground")
|
|
|
.short('f')
|
|
|
.short('f')
|
|
|
.help("Runs in the foreground"),
|
|
|
|
|
|
|
|
|
.help("Runs in the foreground")
|
|
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
)
|
|
|
)
|
|
|
.arg(
|
|
|
.arg(
|
|
|
Arg::new("pid-file")
|
|
|
Arg::new("pid-file")
|
|
@ -189,14 +192,15 @@ fn main() { |
|
|
Arg::new("no-pid-file")
|
|
|
Arg::new("no-pid-file")
|
|
|
.long("no-pid-file")
|
|
|
.long("no-pid-file")
|
|
|
.help("Do not create any PID file")
|
|
|
.help("Do not create any PID file")
|
|
|
.conflicts_with("pid-file"),
|
|
|
|
|
|
|
|
|
.conflicts_with("pid-file")
|
|
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
)
|
|
|
)
|
|
|
.get_matches();
|
|
|
.get_matches();
|
|
|
|
|
|
|
|
|
match set_log_system(
|
|
|
match set_log_system(
|
|
|
matches.get_one::<String>("log-level").map(|e| e.as_str()),
|
|
|
matches.get_one::<String>("log-level").map(|e| e.as_str()),
|
|
|
matches.contains_id("to-syslog"),
|
|
|
|
|
|
matches.contains_id("to-stderr"),
|
|
|
|
|
|
|
|
|
matches.get_flag("to-syslog"),
|
|
|
|
|
|
matches.get_flag("to-stderr"),
|
|
|
) {
|
|
|
) {
|
|
|
Ok(_) => {}
|
|
|
Ok(_) => {}
|
|
|
Err(e) => {
|
|
|
Err(e) => {
|
|
|