mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
throw exception if PRETIX_CONFIG_FILE can not be opened (#581)
If the environment variable PRETIX_CONFIG_FILE is set but the file can not be read because it does not exists or permission is denied, pretix just runs with default settings. When setting up a new installation this can be confusing and difficult to debug. I think it is safe to assume that someone who sets PRETIX_CONFIG_FILE aims to point it at a readable file, so raising with a more understandable exception is expected or at least helpful. Otherwise, the user will usually get a DisallowedHost exception because the [pretix]url config variable is not set which is not as helpful.
This commit is contained in:
committed by
Raphael Michel
parent
e16f8fc7e9
commit
bbed8e5fae
@@ -14,7 +14,7 @@ from . import __version__
|
||||
|
||||
config = configparser.RawConfigParser()
|
||||
if 'PRETIX_CONFIG_FILE' in os.environ:
|
||||
config.read([os.environ.get('PRETIX_CONFIG_FILE')], encoding='utf-8')
|
||||
config.read_file(open(os.environ.get('PRETIX_CONFIG_FILE'), encoding='utf-8'))
|
||||
else:
|
||||
config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pretix.cfg'],
|
||||
encoding='utf-8')
|
||||
|
||||
Reference in New Issue
Block a user