mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:31:42 +00:00
permitir dominios alternativos #122
This commit is contained in:
parent
6e17a92711
commit
5392f9a942
2 changed files with 25 additions and 1 deletions
|
@ -8,7 +8,8 @@ module Api
|
||||||
password: ENV['HTTP_BASIC_PASSWORD']
|
password: ENV['HTTP_BASIC_PASSWORD']
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render json: Site.all.order(:name).pluck(:name)
|
render json: Site.all.order(:name).pluck(:name) +
|
||||||
|
DeployAlternativeDomain.all.map(&:hostname)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Detecta si se puede generar un certificado
|
# Detecta si se puede generar un certificado
|
||||||
|
|
23
app/models/deploy_alternative_domain.rb
Normal file
23
app/models/deploy_alternative_domain.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Soportar dominios alternativos
|
||||||
|
class DeployAlternativeDomain < Deploy
|
||||||
|
store :values, accessors: %i[hostname], coder: JSON
|
||||||
|
|
||||||
|
# Generar un link simbólico del sitio principal al alternativo
|
||||||
|
def deploy
|
||||||
|
File.symlink?(destination) ||
|
||||||
|
File.symlink(site.hostname, destination).zero?
|
||||||
|
end
|
||||||
|
|
||||||
|
# No hay límite para los dominios alternativos
|
||||||
|
def limit; end
|
||||||
|
|
||||||
|
def size
|
||||||
|
File.size destination
|
||||||
|
end
|
||||||
|
|
||||||
|
def destination
|
||||||
|
File.join(Rails.root, '_deploy', hostname.gsub(/\.\z/, ''))
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue