Skip to content

Commit

Permalink
refactor(config)!: Use clap derive API and figment for config parsing
Browse files Browse the repository at this point in the history
Use figment for parsing configuration from env vars, cli, toml file.

Switch from clap builder api to clap derive api. This creates a struct
that then be fed to figment.

Remove old homegrown config builder.

Remove direct toml dependency, it's handled by figment now.

Update documentation concerning booleanss and numbers.

BREAKING CHANGE: toml booleans and numbers in the config files
can't be quoted anymore. Previously they had to be quoted strings due
to implementation issues.
  • Loading branch information
alcroito committed May 25, 2023
1 parent f7d9524 commit f449fdd
Show file tree
Hide file tree
Showing 12 changed files with 408 additions and 1,015 deletions.
57 changes: 2 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions config/do_ddns.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ update_interval = "30mins"
digital_ocean_token = "aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz"

# Setting this option to true will cause the final IP updates to be skipped.
dry_run = "false"
dry_run = false

# Setting this option to true will enable resolving of ipv6 addresses and
# storing them in AAAA records.
# ipv6 = "true"
# ipv6 = true

# Enable collection of statistics (how often does the public IP change) in
# a local sqlite database.
# Disabled by default.
# collect_stats = "true"
# collect_stats = true

# File path where the sqlite database with statistics will be stored.
# By default stored in one of the following locations:
Expand All @@ -26,16 +26,16 @@ dry_run = "false"

# Enable web server to visualize collected statistics.
# Disabled by default.
# enable_web = "true"
# enable_web = true

# An IPv4 / IPv6 address or host name where to serve HTTP pages on.
# In case of host that has a dual IP stack, both will be used.
# Default is localhost.
# listen_hostname = "true"
# listen_hostname = true

# Port number where to serve HTTP pages on.
# Default is 8095.
# listen_port = "8095"
# listen_port = 8095

## Simple config mode sample

Expand All @@ -48,7 +48,7 @@ subdomain_to_update = "home"

# Updates the IP of the 'mysite.com' A record.
# domain_root = "mysite.com"
# update_domain_root = "true"
# update_domain_root = true


## Advanced config mode sample
Expand Down
1 change: 0 additions & 1 deletion crates/dyndns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ serde_json = "1"
serde_with = "3"
signal-hook = { version = "0.3", features = ["extended-siginfo"] }
tailsome = "1"
toml = "0.7"
tracing = "0.1"
tracing-log = "0.1"
tracing-subscriber = "0.3"
Expand Down
Loading

0 comments on commit f449fdd

Please sign in to comment.