lib/harbr/job.rb in harbr-0.1.88 vs lib/harbr/job.rb in harbr-0.1.89
- old
+ new
@@ -40,11 +40,11 @@
end
def collate_containers(name, host, port, host_header_aliases = [])
containers = Harbr::Container::Repository.new
container = containers.find_by_header(host)
-
+
if container.nil?
container = Harbr::Container.new
container.name = name
container.host_header = host
container.ip = "127.0.0.1"
@@ -54,17 +54,29 @@
else
container.port = port
containers.update(container)
end
+
if host_header_aliases
host_header_aliases.each do |host_header_alias|
+
container = Harbr::Container.new
container.name = "#{name} -> #{host_header_alias}"
container.host_header = host_header_alias
container.ip = "127.0.0.1"
container.port = port
containers.create(container) unless containers.find_by_header(host_header_alias)
+
+ if(container.name.starts_with?("live"))
+ container = Harbr::Container.new
+ container.name = "#{name} -> #{host_header_alias.gsub("live","")}"
+ container.host_header = host_header_alias.gsub("live","")
+ container.ip = "127.0.0.1"
+ container.port = port
+ containers.create(container) unless containers.find_by_header(host_header_alias)
+ end
+
end
end
containers.all
end