Require SERVER_NAME in the configuration

Since we rely more and more on the presence of SERVER_NAME in the
configuration, we make it a hard requirement, before checking if it is
a FQDN.
This commit is contained in:
Francesco Siddi 2018-03-18 18:53:08 +01:00
parent 6a0e0721e9
commit 99e0eb7a7a

View File

@ -144,8 +144,11 @@ class PillarServer(BlinkerCompatibleEve):
if not self.config.get('SECRET_KEY'):
raise ConfigurationMissingError('SECRET_KEY configuration key is missing')
server_name = self.config.get('SERVER_NAME', '')
if server_name != 'localhost' and '.' not in server_name:
server_name = self.config.get('SERVER_NAME')
if not server_name:
raise ConfigurationMissingError('SERVER_NAME configuration key is missing, should be a '
'FQDN with TLD')
elif server_name != 'localhost' and '.' not in server_name:
raise ConfigurationMissingError('SERVER_NAME should contain a FQDN with TLD')
def _load_flask_config(self):