Esempio n. 1
0
 def resolve_hostnames(self, info, **kwargs):
     server_config = info.context.get('server_config')
     if server_config is None:
         logger.warning(
             'can not determine hostnames without the server configuration')
         return
     return web_tools.get_hostnames(server_config)
Esempio n. 2
0
	def test_get_hostnames(self):
		new_hostname = random_string(16)
		config_hostnames = self.config.get_if_exists('server.hostnames', [])
		config_hostnames.append(new_hostname)
		self.config.set('server.hostnames', config_hostnames)
		hostnames = web_tools.get_hostnames(self.config)
		self.assertIsInstance(hostnames, tuple)
		self.assertIn(new_hostname, hostnames)
Esempio n. 3
0
def rpc_hostnames_get(handler):
	"""
	Get the hostnames that are configured for use with this server.

	.. versionadded:: 1.13.0

	:return: The configured hostnames.
	:rtype: list
	"""
	return list(web_tools.get_hostnames(handler.config))
Esempio n. 4
0
def rpc_hostnames_get(handler):
	"""
	Get the hostnames that are configured for use with this server. This is not
	related to the ``ssl/hostnames`` RPC methods which deal with hostnames as
	they relate to SSL for the purposes of certificate usage.

	.. versionadded:: 1.13.0

	:return: The configured hostnames.
	:rtype: list
	"""
	return list(web_tools.get_hostnames(handler.config))
Esempio n. 5
0
	def resolve_hostnames(self, info, **kwargs):
		server_config = info.context.get('server_config')
		if server_config is None:
			logger.warning('can not determine hostnames without the server configuration')
			return
		return web_tools.get_hostnames(server_config)