Add rocket.toml and peach-dyndns-server.service
This commit is contained in:
parent
cb604de46c
commit
5b7112645b
|
@ -1299,7 +1299,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "peach-dyndns-host"
|
name = "peach-dyndns-server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap-log-flag",
|
"clap-log-flag",
|
||||||
|
|
15
Cargo.toml
15
Cargo.toml
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "peach-dyndns-host"
|
name = "peach-dyndns-server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Michael Williams <michael.williams@enspiral.com>", "Max Fowler <notplants@mfowler.info>"]
|
authors = ["Michael Williams <michael.williams@enspiral.com>", "Max Fowler <notplants@mfowler.info>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
@ -24,6 +24,13 @@ dotenv = "0.15.0"
|
||||||
tera = "1"
|
tera = "1"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
|
||||||
[[bin]]
|
[package.metadata.deb]
|
||||||
name = "main"
|
depends = "$auto"
|
||||||
path = "src/main.rs"
|
extended-description = """\
|
||||||
|
peach-dyndns is an http API to create dynamic-dns configurations for bind9."""
|
||||||
|
maintainer-scripts="debian"
|
||||||
|
systemd-units = { unit-name = "peach-dyndns-server" }
|
||||||
|
assets = [
|
||||||
|
["target/release/peach-dyndns-server", "usr/bin/", "755"],
|
||||||
|
]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[default]
|
||||||
|
template_dir = "templates/"
|
||||||
|
port = 3001
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=An http API to create dynamic-dns configurations for bind9.
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=peach-dyndns
|
||||||
|
Group=bind
|
||||||
|
Environment="RUST_LOG=info"
|
||||||
|
ExecStart=/usr/bin/peach-dyndns-server
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -4,6 +4,8 @@
|
||||||
extern crate rocket;
|
extern crate rocket;
|
||||||
|
|
||||||
use crate::routes::{index, register_domain, check_available};
|
use crate::routes::{index, register_domain, check_available};
|
||||||
|
use rocket::Config;
|
||||||
|
use rocket::figment::{Figment, Profile, providers::{Format, Toml, Serialized, Env}};
|
||||||
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod routes;
|
mod routes;
|
||||||
|
@ -15,7 +17,12 @@ mod generate_zone;
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let _args = cli::args().expect("error parsing args");
|
let _args = cli::args().expect("error parsing args");
|
||||||
|
|
||||||
let rocket_result = rocket::build()
|
// the following config says to use all default rocket configs
|
||||||
|
// and then override them with any configs specified in Rocket.toml
|
||||||
|
let config = Figment::from(rocket::Config::default())
|
||||||
|
.merge(Toml::file("Rocket.toml").nested());
|
||||||
|
|
||||||
|
let rocket_result = rocket::custom(config)
|
||||||
.mount("/", routes![index, register_domain, check_available])
|
.mount("/", routes![index, register_domain, check_available])
|
||||||
.launch()
|
.launch()
|
||||||
.await;
|
.await;
|
||||||
|
|
Loading…
Reference in New Issue