Fix config to match the README, add proxy to README
This commit is contained in:
parent
a917f32f04
commit
b060cafa8e
@ -2,6 +2,15 @@ origin:
|
|||||||
store_dir_path: /tmp/domani_dev_env/origin
|
store_dir_path: /tmp/domani_dev_env/origin
|
||||||
domain:
|
domain:
|
||||||
store_dir_path: /tmp/domani_dev_env/domain
|
store_dir_path: /tmp/domani_dev_env/domain
|
||||||
|
builtins:
|
||||||
|
foo:
|
||||||
|
kind: proxy
|
||||||
|
url: ok
|
||||||
|
bar:
|
||||||
|
kind: git
|
||||||
|
url: a
|
||||||
|
branch_name: b
|
||||||
|
public: true
|
||||||
service:
|
service:
|
||||||
http:
|
http:
|
||||||
form_method: GET
|
form_method: GET
|
||||||
|
20
README.md
20
README.md
@ -31,7 +31,7 @@ origin:
|
|||||||
# etc...) will be stored.
|
# etc...) will be stored.
|
||||||
#
|
#
|
||||||
# This should be different than any other store_dir_paths.
|
# This should be different than any other store_dir_paths.
|
||||||
store_dir_path: REQUIRED
|
#store_dir_path: REQUIRED
|
||||||
|
|
||||||
domain:
|
domain:
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ domain:
|
|||||||
# certificates, etc...) will be stored.
|
# certificates, etc...) will be stored.
|
||||||
#
|
#
|
||||||
# This should be different than any other store_dir_paths.
|
# This should be different than any other store_dir_paths.
|
||||||
store_dir_path: REQUIRED
|
#store_dir_path: REQUIRED
|
||||||
|
|
||||||
#dns:
|
#dns:
|
||||||
|
|
||||||
@ -59,17 +59,26 @@ domain:
|
|||||||
#builtins:
|
#builtins:
|
||||||
|
|
||||||
# An example built-in domain backed by a git repo.
|
# An example built-in domain backed by a git repo.
|
||||||
#example.com:
|
#git.example.com:
|
||||||
# kind: git
|
# kind: git
|
||||||
# url: "https://somewhere.com/some/repo.git"
|
# url: "https://somewhere.com/some/repo.git"
|
||||||
# branch: main
|
# branch_name: main
|
||||||
# public: false
|
# public: false
|
||||||
|
|
||||||
|
# An example built-in domain backed by a reverse-proxy to some other
|
||||||
|
# web-service. Proxies are currently limited in the following ways:
|
||||||
|
# * url must be to an http endpoint (not https)
|
||||||
|
# * dns.resolver_addr is ignored and the system-wide dns is used
|
||||||
|
#
|
||||||
|
#proxy.example.com:
|
||||||
|
# kind: proxy
|
||||||
|
# url: "http://some.other.service.com"
|
||||||
|
|
||||||
service:
|
service:
|
||||||
|
|
||||||
# Passphrase which must be given by users who are configuring new domains via
|
# Passphrase which must be given by users who are configuring new domains via
|
||||||
# the web interface.
|
# the web interface.
|
||||||
passphrase: foobar
|
#passphrase: REQUIRED
|
||||||
|
|
||||||
# DNS records which users must add to their domain's DNS so that
|
# DNS records which users must add to their domain's DNS so that
|
||||||
# Domani can serve the domains. All records given must route to this Domani
|
# Domani can serve the domains. All records given must route to this Domani
|
||||||
@ -137,7 +146,6 @@ Within the shell which opens you can do `cargo run` to start a local instance.
|
|||||||
|
|
||||||
* Support for more backends than just git repositories, including:
|
* Support for more backends than just git repositories, including:
|
||||||
* IPFS/IPNS
|
* IPFS/IPNS
|
||||||
* Alternative URLs (reverse proxy)
|
|
||||||
* Small static files (e.g. for well-knowns)
|
* Small static files (e.g. for well-knowns)
|
||||||
* Google Drive
|
* Google Drive
|
||||||
* Dropbox
|
* Dropbox
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub origin: crate::origin::Config,
|
pub origin: crate::origin::Config,
|
||||||
pub domain: crate::domain::Config,
|
pub domain: crate::domain::Config,
|
||||||
|
@ -19,6 +19,7 @@ use sha2::{Digest, Sha256};
|
|||||||
/// Defines how a domain will behave when it is accessed. These are configured by the owner of the
|
/// Defines how a domain will behave when it is accessed. These are configured by the owner of the
|
||||||
/// domain during setup.
|
/// domain during setup.
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
|
#[serde(flatten)]
|
||||||
pub origin_descr: origin::Descr,
|
pub origin_descr: origin::Descr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::{collections, net, path, str::FromStr};
|
use std::{collections, net, path, str::FromStr};
|
||||||
|
|
||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::domain;
|
use crate::domain;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ fn default_resolver_addr() -> net::SocketAddr {
|
|||||||
net::SocketAddr::from_str("1.1.1.1:53").unwrap()
|
net::SocketAddr::from_str("1.1.1.1:53").unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct ConfigDNS {
|
pub struct ConfigDNS {
|
||||||
#[serde(default = "default_resolver_addr")]
|
#[serde(default = "default_resolver_addr")]
|
||||||
pub resolver_addr: net::SocketAddr,
|
pub resolver_addr: net::SocketAddr,
|
||||||
@ -22,25 +22,26 @@ impl Default for ConfigDNS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct ConfigACME {
|
pub struct ConfigACME {
|
||||||
pub contact_email: String,
|
pub contact_email: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct BuiltinDomain {
|
pub struct ConfigBuiltinDomain {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub settings: domain::Settings,
|
pub settings: domain::Settings,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
pub public: bool,
|
pub public: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub store_dir_path: path::PathBuf,
|
pub store_dir_path: path::PathBuf,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub dns: ConfigDNS,
|
pub dns: ConfigDNS,
|
||||||
pub acme: Option<ConfigACME>,
|
pub acme: Option<ConfigACME>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub builtins: collections::HashMap<domain::Name, BuiltinDomain>,
|
pub builtins: collections::HashMap<domain::Name, ConfigBuiltinDomain>,
|
||||||
}
|
}
|
||||||
|
@ -99,13 +99,13 @@ impl Store for FSStore {
|
|||||||
|
|
||||||
pub struct StoreWithBuiltin<S: Store> {
|
pub struct StoreWithBuiltin<S: Store> {
|
||||||
inner: S,
|
inner: S,
|
||||||
domains: collections::HashMap<domain::Name, domain::config::BuiltinDomain>,
|
domains: collections::HashMap<domain::Name, domain::config::ConfigBuiltinDomain>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Store> StoreWithBuiltin<S> {
|
impl<S: Store> StoreWithBuiltin<S> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
inner: S,
|
inner: S,
|
||||||
builtin_domains: collections::HashMap<domain::Name, domain::config::BuiltinDomain>,
|
builtin_domains: collections::HashMap<domain::Name, domain::config::ConfigBuiltinDomain>,
|
||||||
) -> StoreWithBuiltin<S> {
|
) -> StoreWithBuiltin<S> {
|
||||||
StoreWithBuiltin {
|
StoreWithBuiltin {
|
||||||
inner,
|
inner,
|
||||||
|
@ -28,6 +28,9 @@ struct Cli {
|
|||||||
env = "DOMANI_CONFIG_PATH"
|
env = "DOMANI_CONFIG_PATH"
|
||||||
)]
|
)]
|
||||||
config_path: path::PathBuf,
|
config_path: path::PathBuf,
|
||||||
|
|
||||||
|
#[arg(long, help = "Dump the full process configuration to stdout and exit")]
|
||||||
|
dump_config: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@ -78,6 +81,12 @@ async fn main() {
|
|||||||
config
|
config
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if cli.dump_config {
|
||||||
|
let stdout = std::io::stdout().lock();
|
||||||
|
serde_yaml::to_writer(stdout, &config).expect("writing config to stdout");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let origin_store = domani::origin::git::FSStore::new(&config.origin)
|
let origin_store = domani::origin::git::FSStore::new(&config.origin)
|
||||||
.expect("git origin store initialization failed");
|
.expect("git origin store initialization failed");
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path;
|
use std::path;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub store_dir_path: path::PathBuf,
|
pub store_dir_path: path::PathBuf,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,10 @@ use sha2::{Digest, Sha256};
|
|||||||
#[serde(tag = "kind")]
|
#[serde(tag = "kind")]
|
||||||
/// A unique description of an origin, from where a domain might be served.
|
/// A unique description of an origin, from where a domain might be served.
|
||||||
pub enum Descr {
|
pub enum Descr {
|
||||||
|
#[serde(rename = "git")]
|
||||||
Git { url: String, branch_name: String },
|
Git { url: String, branch_name: String },
|
||||||
|
|
||||||
|
#[serde(rename = "proxy")]
|
||||||
Proxy { url: String },
|
Proxy { url: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ impl From<ConfigDNSRecord> for domain::checker::DNSRecord {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub passphrase: String,
|
pub passphrase: String,
|
||||||
pub dns_records: Vec<ConfigDNSRecord>,
|
pub dns_records: Vec<ConfigDNSRecord>,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{net, str::FromStr};
|
use std::{net, str::FromStr};
|
||||||
|
|
||||||
fn default_http_addr() -> net::SocketAddr {
|
fn default_http_addr() -> net::SocketAddr {
|
||||||
net::SocketAddr::from_str("[::]:3030").unwrap()
|
net::SocketAddr::from_str("[::]:3030").unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum ConfigFormMethod {
|
pub enum ConfigFormMethod {
|
||||||
GET,
|
GET,
|
||||||
POST,
|
POST,
|
||||||
@ -35,7 +35,7 @@ impl AsRef<hyper::Method> for ConfigFormMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
#[serde(default = "default_http_addr")]
|
#[serde(default = "default_http_addr")]
|
||||||
pub http_addr: net::SocketAddr,
|
pub http_addr: net::SocketAddr,
|
||||||
|
Loading…
Reference in New Issue
Block a user