1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-07-12 07:11:17 +02:00

Use domain for $origin

This commit is contained in:
cn
2013-04-27 15:08:36 +02:00
parent bbf0c42141
commit 09f4afe99e
3 changed files with 7 additions and 7 deletions

View File

@ -2,9 +2,9 @@
module Dyndnsd
module Generator
class Bind
def initialize(config)
def initialize(domain, config)
@domain = domain
@ttl = config['ttl']
@origin = config['origin']
@dns = config['dns']
@email_addr = config['email_addr']
end
@ -12,13 +12,13 @@ module Dyndnsd
def generate(zone)
out = []
out << "$TTL #{@ttl}"
out << "$ORIGIN #{@origin}"
out << "$ORIGIN #{@domain}."
out << ""
out << "@ IN SOA #{@dns} #{@email_addr} ( #{zone['serial']} 3h 5m 1w 1h )"
out << "@ IN NS #{@dns}"
out << ""
zone['hosts'].each do |hostname,ip|
name = hostname.chomp('.' + @origin[0..-2])
name = hostname.chomp('.' + @domain)
out << "#{name} IN A #{ip}"
end
out << ""