A cloudflare backed DDNS service written in Rust
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

#[macro_use]
extern crate serde_derive;
extern crate actix_web;
extern crate clap;
extern crate serde;
use clap::{App, Arg};
mod router;
mod server;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
fn main() {
let args = App::new("Dynamic DNS Server")
.version(VERSION)
.author("Drew Short <warrick@sothr.com>")
.about("Recieve DDNS requests and update cloudflare subdomains")
.arg(
Arg::with_name("config")
.short("c")
.long("config")
.value_name("PATH")
.help("Set a custom configuration file path. DEFAULT=/etc/rsddns/rsddns.yml.")
.takes_value(true),
)
.arg(
Arg::with_name("port")
.short("p")
.long("port")
.value_name("PORT")
.help("The port to run the server on.")
.takes_value(true),
)
.get_matches();
let config: &str = args.value_of("config").unwrap_or("/etc/rsddns/rsddns.yml");
let port: i32 = args
.value_of("port")
.unwrap_or("8080")
.parse::<i32>()
.unwrap_or(8080);
println!("Starting server on {} with config {}", port, config);
actix_web::server::new(|| router::create())
.bind(format!("localhost:{}", port))
.unwrap()
.run();
}