Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Replace yaml with toml #2

Closed
mpdevilleres opened this issue Dec 14, 2023 · 1 comment
Closed

Proposal: Replace yaml with toml #2

mpdevilleres opened this issue Dec 14, 2023 · 1 comment

Comments

@mpdevilleres
Copy link
Contributor

mpdevilleres commented Dec 14, 2023

as of python 3.11 toml parser is part of standard library.

what does it mean for the project is as follow.

  • remove third party dependency (PyYAML)
  • improve readability of configuration reference

current yaml

#########################
# main settings

domain: yourdomain.com
ns1: 127.0.0.1
ns2: 127.0.0.1

#########################
# other configurables

# server address
listen_addr: 0.0.0.0:53

# debug (0 or 1)
debug: 0

# default TTL
ttl: 60

# default latency (in ms)
sleep: 0

# a 3rdparty domain which we don't own
a3rdparty_domain: whatever.com

# known DNS resolvers / clients connecting to us
known_servers:
  127.0.0.1:      localhost
  1.2.3.4:        powerdns1
  1.2.3.5:        powerdns2
  2.3.4.5:        bind-test1
  4.5.6.7:        msdns-test1

#########################

will look like with toml

[main]
domain = 'yourdomain.com'
ns1 = '127.0.0.1'
ns2 = '127.0.0.1'

# server address
listen_addr = '0.0.0.0:53'

# debug (0 or 1)
debug = 0

# default TTL
ttl = 60

# default latency (in ms)
sleep = 0

# a 3rdparty domain which we don't own
a3rdparty_domain = 'whatever.com'

known_servers = """
127.0.0.1   localhost
1.2.3.4     powerdns1
1.2.3.5     powerdns2
2.3.4.5     bind-test1
4.5.6.7     msdns-test1
"""

just a little caveat this will not work to python 3.10 below. so it will be a good idea to update the readme stating this only works with python 3.11 and above.

PR: #3

@ivan-jedek
Copy link
Collaborator

A great idea, thank you @mpdevilleres !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants