initial commit - laid out stuff
This commit is contained in:
commit
0d0cb945a1
6 changed files with 463 additions and 0 deletions
46
src/main.rs
Normal file
46
src/main.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
use clap::Parser;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
mod build;
|
||||
mod cli;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
struct SiteInfo {
|
||||
name: String,
|
||||
subdomain: String,
|
||||
///
|
||||
socket_address_or_port: String,
|
||||
/// What auth file to use
|
||||
auth: u8,
|
||||
conf_file: PathBuf,
|
||||
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
struct Config {
|
||||
output_dir: String,
|
||||
domain: String,
|
||||
/// Subdomains/services in the format `subdomain: SiteInfo`
|
||||
subdomains: HashMap<String, SiteInfo>,
|
||||
/// Paths to the htpasswd file for each auth number - starts at 0, goes to 255; see [`SiteInfo`]
|
||||
htpasswd_files: Vec<PathBuf>,
|
||||
/// Default IP for if it's not specified in `socket_address_or_port` in [`SiteInfo`]. Defaults to localhost if not specified.
|
||||
#[serde(default = "default_default_ip")]
|
||||
default_ip: String
|
||||
}
|
||||
|
||||
fn main() {
|
||||
build::completion_builder().unwrap();
|
||||
|
||||
let args = cli::Cli::parse();
|
||||
|
||||
let config = args.config;
|
||||
|
||||
println!("Config: {}", config.to_str().unwrap())
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
fn default_default_ip() -> String {
|
||||
return "localhost".to_string();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue