Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
reesericci committed Aug 9, 2023
1 parent 1d3aad6 commit 04353d4
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .vscode/rdbg_autoattach.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"type": "rdbg",
"name": "Attach with rdbg",
"request": "attach",
"rdbgPath": "/home/me/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.7.1/exe/rdbg",
"debugPort": "/run/user/1000/ruby-debug-me-29135",
"rdbgPath": "/var/home/reesericci/.rvm/gems/ruby-3.1.2/gems/debug-1.7.1/exe/rdbg",
"debugPort": "/run/user/1000/ruby-debug-reesericci-203005",
"localfs": true,
"autoAttach": "0.4477872131555375"
"autoAttach": "0.5611118331542511"
}
15 changes: 9 additions & 6 deletions app/models/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def self.destroy_all_host!(host)


def self.all
dnsimple_records = client.zones.all_zone_records(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"]).data.select { |record| !record.system_record }
dnsimple_records = client.zones.all_zone_records(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain).data.select { |record| !record.system_record }

records = []
for r in dnsimple_records
if !r.name.blank?
Expand Down Expand Up @@ -185,7 +186,8 @@ def domain

def persist
if @name == "@" || @name == "" || @name == nil
record = client.zones.create_zone_record(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"], name: Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)

record = client.zones.create_zone_record(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain, name: Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)
@_id = record.data.id

ttl = record.data.ttl
Expand All @@ -197,7 +199,8 @@ def persist

name.gsub!("@", Domain.find(domain_id).host)

record = client.zones.create_zone_record(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"], name: name + "." + Domain.find(domain_id).host, type: type, content: content, ttl: ttl, priority: priority)
record = client.zones.create_zone_record(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain, name: name + "." + Domain.find(domain_id).host, type: type, content: content, ttl: ttl, priority: priority)

@_id = record.data.id

ttl = record.data.ttl
Expand All @@ -209,7 +212,7 @@ def persist

def update_record
if name == "@" || name == "" || name == nil
record = client.zones.update_zone_record(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"], id, name: Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)
record = client.zones.update_zone_record(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain, id, name: Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)
@_id = record.data.id

ttl = record.data.ttl
Expand All @@ -221,7 +224,7 @@ def update_record

name.gsub!("@", Domain.find(domain_id).host)

record = client.zones.update_zone_record(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"], id, name: name + "." + Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)
record = client.zones.update_zone_record(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain, id, name: name + "." + Domain.find(domain_id).host , type: type, content: content, ttl: ttl, priority: priority)
@_id = record.data.id

ttl = record.data.ttl
Expand All @@ -231,7 +234,7 @@ def update_record
end

def destroy_record
client.zones.delete_zone_record(Rails.application.credentials.dnsimple.account_id, ENV["DOMAIN"], id)
client.zones.delete_zone_record(Rails.application.credentials.dnsimple.account_id, Rails.application.config.domain, id)
@_persisted = false
true
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/domains/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= turbo_frame_tag @domain do %>
<a href="<%= domain_path(@domain) %>" class="flex flex-col p-4 items-start gap-[1.375rem] bg-text text-black shadow-md rounded-2xl h-full">
<h2 class="leading-none text-3 font-body">
<%= @domain.host + "." + ENV["DOMAIN"] %>
<%= @domain.host + "." + Rails.application.config.domain %>
</h2>
<div class="flex flex-col items-start gap-2">
<% if @records.length > 0 %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/domain.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<div class="flex-1 flex flex-col gap-8">
<h2 class="font-heading text-4 md:text-5 lg:text-6 text-blue">
<%= @domain.host %><wbr><span class="opacity-50">.<%= ENV["DOMAIN"] %></span>
<%= @domain.host %><wbr><span class="opacity-50">.<%= Rails.application.config.domain %></span>
</h2>
<div>
<%= yield_nested %>
Expand Down
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ class Application < Rails::Application
api_token: Rails.application.credentials.postmark_api_token
}

# Change to where you're hosting Obl.ong in production
config.webauthn_origin = "https://admin.obl.ong"

# Change to the domain where you're registering subdomains
config.domain = "obl.ong"
end
end
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

# Origin for the WebAuthn RP
config.webauthn_origin = "http://localhost:3000"
end
2 changes: 1 addition & 1 deletion config/initializers/webauthn.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WebAuthn.configure do |config|
# This value needs to match `window.location.origin` evaluated by
# the User Agent during registration and authentication ceremonies.
config.origin = "http://localhost:3000"
config.origin = Rails.application.config.webauthn_origin

# Relying Party name for display purposes
config.rp_name = "Obl.ong"
Expand Down

0 comments on commit 04353d4

Please sign in to comment.