mirror of
https://github.com/cmur2/dyndnsd.git
synced 2024-12-22 00:54:22 +01:00
Use domain for $origin
This commit is contained in:
parent
bbf0c42141
commit
09f4afe99e
@ -119,7 +119,7 @@ module Dyndnsd
|
|||||||
config = YAML::load(File.open(config_file, 'r') { |f| f.read })
|
config = YAML::load(File.open(config_file, 'r') { |f| f.read })
|
||||||
|
|
||||||
db = Database.new(config['db'])
|
db = Database.new(config['db'])
|
||||||
updater = Updater::CommandWithBindZone.new(config['updater']['params']) if config['updater']['name'] == 'command_with_bind_zone'
|
updater = Updater::CommandWithBindZone.new(config['domain'], config['updater']['params']) if config['updater']['name'] == 'command_with_bind_zone'
|
||||||
responder = Responder::DynDNSStyle.new
|
responder = Responder::DynDNSStyle.new
|
||||||
|
|
||||||
app = Daemon.new(config, db, updater, responder)
|
app = Daemon.new(config, db, updater, responder)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
module Dyndnsd
|
module Dyndnsd
|
||||||
module Generator
|
module Generator
|
||||||
class Bind
|
class Bind
|
||||||
def initialize(config)
|
def initialize(domain, config)
|
||||||
|
@domain = domain
|
||||||
@ttl = config['ttl']
|
@ttl = config['ttl']
|
||||||
@origin = config['origin']
|
|
||||||
@dns = config['dns']
|
@dns = config['dns']
|
||||||
@email_addr = config['email_addr']
|
@email_addr = config['email_addr']
|
||||||
end
|
end
|
||||||
@ -12,13 +12,13 @@ module Dyndnsd
|
|||||||
def generate(zone)
|
def generate(zone)
|
||||||
out = []
|
out = []
|
||||||
out << "$TTL #{@ttl}"
|
out << "$TTL #{@ttl}"
|
||||||
out << "$ORIGIN #{@origin}"
|
out << "$ORIGIN #{@domain}."
|
||||||
out << ""
|
out << ""
|
||||||
out << "@ IN SOA #{@dns} #{@email_addr} ( #{zone['serial']} 3h 5m 1w 1h )"
|
out << "@ IN SOA #{@dns} #{@email_addr} ( #{zone['serial']} 3h 5m 1w 1h )"
|
||||||
out << "@ IN NS #{@dns}"
|
out << "@ IN NS #{@dns}"
|
||||||
out << ""
|
out << ""
|
||||||
zone['hosts'].each do |hostname,ip|
|
zone['hosts'].each do |hostname,ip|
|
||||||
name = hostname.chomp('.' + @origin[0..-2])
|
name = hostname.chomp('.' + @domain)
|
||||||
out << "#{name} IN A #{ip}"
|
out << "#{name} IN A #{ip}"
|
||||||
end
|
end
|
||||||
out << ""
|
out << ""
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
module Dyndnsd
|
module Dyndnsd
|
||||||
module Updater
|
module Updater
|
||||||
class CommandWithBindZone
|
class CommandWithBindZone
|
||||||
def initialize(config)
|
def initialize(domain, config)
|
||||||
@zone_file = config['zone_file']
|
@zone_file = config['zone_file']
|
||||||
@command = config['command']
|
@command = config['command']
|
||||||
@generator = Generator::Bind.new(config)
|
@generator = Generator::Bind.new(domain, config)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(zone)
|
def update(zone)
|
||||||
|
Loading…
Reference in New Issue
Block a user