diff --git a/tacd/src/main.rs b/tacd/src/main.rs index b06ccb2..e3c3caf 100644 --- a/tacd/src/main.rs +++ b/tacd/src/main.rs @@ -1,3 +1,12 @@ +#[cfg(not(feature = "standalone"))] +mod openssl_server; +#[cfg(not(feature = "standalone"))] +use openssl_server::start as server_start; +#[cfg(feature = "standalone")] +mod standalone_server; +#[cfg(feature = "standalone")] +use standalone_server::start as server_start; + use acme_common::crypto::X509Certificate; use acme_common::error::Error; use clap::{App, Arg, ArgMatches}; @@ -5,8 +14,6 @@ use log::{debug, error, info}; use std::fs::File; use std::io::{self, Read}; -mod server; - const APP_NAME: &str = env!("CARGO_PKG_NAME"); const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); const DEFAULT_PID_FILE: &str = "/var/run/admed.pid"; @@ -47,7 +54,7 @@ fn init(cnf: &ArgMatches) -> Result<(), Error> { let listen_addr = cnf.value_of("listen").unwrap_or(DEFAULT_LISTEN_ADDR); let (pk, cert) = X509Certificate::from_acme_ext(&domain, &ext)?; info!("Starting {} on {} for {}", APP_NAME, listen_addr, domain); - server::start(listen_addr, &cert, &pk)?; + server_start(listen_addr, &cert, &pk)?; Ok(()) } diff --git a/tacd/src/server.rs b/tacd/src/openssl_server.rs similarity index 100% rename from tacd/src/server.rs rename to tacd/src/openssl_server.rs diff --git a/tacd/src/standalone_server.rs b/tacd/src/standalone_server.rs new file mode 100644 index 0000000..9134bfc --- /dev/null +++ b/tacd/src/standalone_server.rs @@ -0,0 +1,10 @@ +use acme_common::crypto::{PrivateKey, X509Certificate}; +use acme_common::error::Error; + +pub fn start( + listen_addr: &str, + certificate: &X509Certificate, + private_key: &PrivateKey, +) -> Result<(), Error> { + Err("The standalone server is not implemented yet.".into()) +}