mirror of
https://github.com/SeriousBug/gandi-live-dns-rust
synced 2024-05-18 03:09:04 -05:00
removed unneccessary references
This commit is contained in:
parent
cca2f3228f
commit
283cb589bd
|
@ -69,7 +69,7 @@ fn load_config_from<P: std::convert::AsRef<std::path::Path>>(path: P) -> anyhow:
|
||||||
|
|
||||||
pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
||||||
let mut config = match &opts.config {
|
let mut config = match &opts.config {
|
||||||
Some(config_path) => load_config_from(&config_path),
|
Some(config_path) => load_config_from(config_path),
|
||||||
None => {
|
None => {
|
||||||
let confpath = ProjectDirs::from("me", "kaangenc", "gandi-dynamic-dns")
|
let confpath = ProjectDirs::from("me", "kaangenc", "gandi-dynamic-dns")
|
||||||
.and_then(|dir| Some(PathBuf::from(dir.config_dir()).join("config.toml")))
|
.and_then(|dir| Some(PathBuf::from(dir.config_dir()).join("config.toml")))
|
||||||
|
@ -106,7 +106,7 @@ pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
||||||
|
|
||||||
pub fn validate_config(config: &Config) -> anyhow::Result<()> {
|
pub fn validate_config(config: &Config) -> anyhow::Result<()> {
|
||||||
for entry in &config.entry {
|
for entry in &config.entry {
|
||||||
for entry_type in Config::types(&entry) {
|
for entry_type in Config::types(entry) {
|
||||||
if entry_type != "A" && entry_type != "AAAA" {
|
if entry_type != "A" && entry_type != "AAAA" {
|
||||||
anyhow::bail!("Entry {} has invalid type {}", entry.name, entry_type);
|
anyhow::bail!("Entry {} has invalid type {}", entry.name, entry_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,11 +68,11 @@ async fn run<IP: IPSource>(base_url: &str, conf: Config) -> anyhow::Result<()> {
|
||||||
|
|
||||||
for entry in &conf.entry {
|
for entry in &conf.entry {
|
||||||
for entry_type in Config::types(entry) {
|
for entry_type in Config::types(entry) {
|
||||||
let fqdn = Config::fqdn(&entry, &conf).to_string();
|
let fqdn = Config::fqdn(entry, &conf).to_string();
|
||||||
let url = GandiAPI {
|
let url = GandiAPI {
|
||||||
fqdn: &fqdn,
|
fqdn: &fqdn,
|
||||||
rrset_name: &entry.name,
|
rrset_name: &entry.name,
|
||||||
rrset_type: &entry_type,
|
rrset_type: entry_type,
|
||||||
base_url,
|
base_url,
|
||||||
}
|
}
|
||||||
.url();
|
.url();
|
||||||
|
@ -83,7 +83,7 @@ async fn run<IP: IPSource>(base_url: &str, conf: Config) -> anyhow::Result<()> {
|
||||||
};
|
};
|
||||||
let payload = APIPayload {
|
let payload = APIPayload {
|
||||||
rrset_values: vec![ip.to_string()],
|
rrset_values: vec![ip.to_string()],
|
||||||
rrset_ttl: Config::ttl(&entry, &conf),
|
rrset_ttl: Config::ttl(entry, &conf),
|
||||||
};
|
};
|
||||||
let req = client.put(url).json(&payload);
|
let req = client.put(url).json(&payload);
|
||||||
let task_governor = governor.clone();
|
let task_governor = governor.clone();
|
||||||
|
|
Loading…
Reference in a new issue