Skip to content

Commit d3fb237

Browse files
authored
Merge pull request #9 from PRProd/changes-for-addon
Added params for HA Addon
2 parents 664d9f7 + 675834c commit d3fb237

6 files changed

Lines changed: 18 additions & 9 deletions

File tree

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ Usage: dreamhost-ddns.exe [OPTIONS]
1919
2020
Options:
2121
-v, --verbose
22-
-c, --config <CONFIG> [default: config.toml]
22+
-c, --config <CONFIG> [default: config.toml]
2323
--dry-run
24-
-h, --help Print help
25-
-V, --version Print version
24+
--api-key <API_KEY>
25+
--record <RECORD>
26+
-h, --help Print help
27+
-V, --version Print version
2628
```
2729
### Linux / Others
2830
```
29-
Usage: dreamhost-ddns [OPTIONS]
31+
Usage: dreamhost-ddns.exe [OPTIONS]
3032
3133
Options:
3234
-v, --verbose
33-
-c, --config <CONFIG> [default: config.toml]
35+
-c, --config <CONFIG> [default: config.toml]
3436
--dry-run
35-
-h, --help Print help
36-
-V, --version Print version
37+
--api-key <API_KEY>
38+
--record <RECORD>
39+
-h, --help Print help
40+
-V, --version Print version
3741
```
3842
You will likely need to make the dreamhost-ddns file executable first:
3943
```bash
2.56 KB
Binary file not shown.
4 KB
Binary file not shown.
3.31 KB
Binary file not shown.
6 KB
Binary file not shown.

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ struct Args {
2525
#[arg(long)]
2626
dry_run: bool,
2727

28+
#[arg(long)]
29+
api_key: Option<String>,
30+
31+
#[arg(long)]
32+
record: Option<String>,
2833
}
2934

3035
#[derive(Debug, Deserialize)]
@@ -60,8 +65,8 @@ fn main() -> Result<()> {
6065
}
6166

6267
let config = load_config(&args.config)?;
63-
let api_key = config.dreamhost_api_key;
64-
let record = config.dns_record;
68+
let api_key = args.api_key.unwrap_or(config.dreamhost_api_key);
69+
let record = args.record.unwrap_or(config.dns_record);
6570

6671
let client = Client::builder()
6772
.timeout(std::time::Duration::from_secs(3))

0 commit comments

Comments
 (0)