pdns 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/pdns/records_controller.rb +6 -8
- data/config/database-pdns.yml +38 -0
- data/config/initializers/pdns.rb +8 -0
- data/lib/generators/templates/pdns.rb +6 -0
- data/lib/pdns.rb +1 -0
- data/lib/pdns/inflect.rb +3 -0
- data/lib/pdns/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb041e4004de0f06365eedc073884621bc5e3af2
|
4
|
+
data.tar.gz: 59245f3ad1c63255382ab8243611b2ee5f8f2384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1f34df30687f887b2745a14e1a6e05a105d0295aaca3de60517466fd8f02d4be09642b7682019a980011c13f85d6af0abad9d4edd354bf3db5de927a7adbbb9
|
7
|
+
data.tar.gz: 1407eba7dea76f0bbe2c327e1cfed13537afe17af1a0a0e09ef64beb58d6b6441a9a774ef9e57fc1096c90b8d23b819f2144b5c78f7a9b98695439ddaca981a1
|
@@ -4,7 +4,7 @@ module PDNS
|
|
4
4
|
class RecordsController < ApplicationController
|
5
5
|
def index
|
6
6
|
set_domain
|
7
|
-
|
7
|
+
@records = @domain.records.where(record_params_without_id)
|
8
8
|
|
9
9
|
render json: @records, status: :ok
|
10
10
|
end
|
@@ -20,7 +20,7 @@ module PDNS
|
|
20
20
|
set_domain
|
21
21
|
delete_records
|
22
22
|
|
23
|
-
@record = @domain.records.create(
|
23
|
+
@record = @domain.records.create(record_params_without_id)
|
24
24
|
|
25
25
|
if @record.save
|
26
26
|
update_serial
|
@@ -69,7 +69,7 @@ module PDNS
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def set_record
|
72
|
-
|
72
|
+
@records = @domain.records.where(record_params)
|
73
73
|
|
74
74
|
raise ActiveRecord::RecordNotFound.new(
|
75
75
|
"record not found"
|
@@ -85,10 +85,12 @@ module PDNS
|
|
85
85
|
def record_params
|
86
86
|
(params[:record] || params).permit %i(name type content ttl prio auth)
|
87
87
|
end
|
88
|
+
alias :record_params_without_id :record_params
|
88
89
|
|
89
90
|
def record_params_with_id_to_name
|
90
|
-
|
91
|
+
record_params_without_id.merge(name: params[:id])
|
91
92
|
end
|
93
|
+
alias :record_params :record_params_with_id_to_name
|
92
94
|
|
93
95
|
def delete_records
|
94
96
|
params['before_delete_conditions'].each do |condition|
|
@@ -99,9 +101,5 @@ module PDNS
|
|
99
101
|
def update_serial
|
100
102
|
@record.update_serial if params[:skip_update_serial].nil?
|
101
103
|
end
|
102
|
-
|
103
|
-
def set_records
|
104
|
-
@records = @domain.records.where(record_params)
|
105
|
-
end
|
106
104
|
end
|
107
105
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
sqlite: &sqlite
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/development.sqlite3
|
4
|
+
|
5
|
+
mysql: &mysql
|
6
|
+
adapter: mysql2
|
7
|
+
username: root
|
8
|
+
host: localhost
|
9
|
+
password:
|
10
|
+
database: pdns_development
|
11
|
+
encoding: utf8
|
12
|
+
|
13
|
+
postgresql: &postgresql
|
14
|
+
pool: 16
|
15
|
+
timeout: 5000
|
16
|
+
adapter: postgresql
|
17
|
+
encoding: unicode
|
18
|
+
username: postgres
|
19
|
+
password:
|
20
|
+
database: pdns_development
|
21
|
+
min_messages: ERROR
|
22
|
+
|
23
|
+
default: &default
|
24
|
+
<<: *mysql
|
25
|
+
|
26
|
+
development:
|
27
|
+
<<: *default
|
28
|
+
|
29
|
+
test:
|
30
|
+
<<: *default
|
31
|
+
database: pdns_test
|
32
|
+
|
33
|
+
production:
|
34
|
+
<<: *default
|
35
|
+
database: pdns
|
36
|
+
host: <%= ENV['DB_HOST'] %>
|
37
|
+
username: <%= ENV['DB_USER'] %>
|
38
|
+
password: <%= ENV['DB_PASS'] %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
PDNS.setup do |c|
|
2
|
+
# Defaults:
|
3
|
+
# c.domain_format = /\A[^-][a-z0-9\-\._]*[^-]\.[a-z0-9-]{2,}\Z/
|
4
|
+
# c.domain_format_for_routes = /[a-z0-9\-\._]*\.[a-z0-9-]{2,}/
|
5
|
+
# c.db_name = :pdns
|
6
|
+
# c.db_conf_path = "config/database-#{self.db_name}.yml"
|
7
|
+
# c.db_dir_path = File.expand_path('../../db', __FILE__)
|
8
|
+
end
|
@@ -5,4 +5,10 @@ PDNS.setup do |c|
|
|
5
5
|
# c.db_name = :pdns
|
6
6
|
# c.db_conf_path = "config/database-#{self.db_name}.yml"
|
7
7
|
# c.db_dir_path = File.expand_path('../../db', __FILE__)
|
8
|
+
# c.domain_as_json = nil
|
9
|
+
# c.record_as_json = nil
|
10
|
+
|
11
|
+
# Examples:
|
12
|
+
# c.domain_as_json = ->(attrs, options) { attrs }
|
13
|
+
# c.record_as_json = ->(attrs, options) { attrs }
|
8
14
|
end
|
data/lib/pdns.rb
CHANGED
data/lib/pdns/inflect.rb
ADDED
data/lib/pdns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linyows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -68,6 +68,8 @@ files:
|
|
68
68
|
- app/models/pdns/application_record.rb
|
69
69
|
- app/models/pdns/domain.rb
|
70
70
|
- app/models/pdns/record.rb
|
71
|
+
- config/database-pdns.yml
|
72
|
+
- config/initializers/pdns.rb
|
71
73
|
- config/routes.rb
|
72
74
|
- db/schema.rb
|
73
75
|
- lib/generators/pdns/install_generator.rb
|
@@ -75,6 +77,7 @@ files:
|
|
75
77
|
- lib/generators/templates/pdns.rb
|
76
78
|
- lib/pdns.rb
|
77
79
|
- lib/pdns/engine.rb
|
80
|
+
- lib/pdns/inflect.rb
|
78
81
|
- lib/pdns/version.rb
|
79
82
|
- lib/tasks/pdns_tasks.rake
|
80
83
|
homepage: https://github.com/linyows/pdns
|