Cross Reference: hostname.rb
xref
: /
ontohub
/
config
/
initializers
/
hostname.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
hostname.rb revision e2586f58230ac2938db5ee91191108988b206e2f
# Compute hostname and port from the hostname in the Settings.
# If no hostname is specified, read the hostname from the OS.
module
Hostname
def
self.fqdn
hostname
=
Settings.hostname.split
(
':'
)
.
first
if
Settings.hostname
if
hostname
==
'localhost'
||
(
hostname
&&
hostname.include
?
(
'.'
)
)
hostname
else
Addrinfo.tcp
(
Socket.gethostname
,
0
)
.getnameinfo.first
end
end
def
self.port
Settings.hostname.split
(
':'
)
.
last
if
Settings.hostname
end
end
Ontohub
::
Application.config.fqdn
=
Hostname.fqdn
Ontohub
::
Application.config.port
=
Hostname.port