Prechádzať zdrojové kódy

Use a global variable rather than thread-local storage for env;
re-enable GUnicorn and Flask debugger.

Stefano Cossu 6 rokov pred
rodič
commit
b5c922a8fb
2 zmenil súbory, kde vykonal 11 pridanie a 5 odobranie
  1. 5 5
      lakesuperior/env.py
  2. 6 0
      server.py

+ 5 - 5
lakesuperior/env.py

@@ -1,7 +1,7 @@
 import threading
 
 '''
-Thread-local bucket for switching configuration. Different environments
+Global bucket for switching configuration. Different environments
 (e.g. webapp, test suite) put the appropriate value in it.
 The most important values to be stored are app_conf (either from
 lakesuperior.config_parser.config or lakesuperior.config_parser.test_config)
@@ -17,8 +17,8 @@ e.g.:
 
 This is automated in non-test environments by importing
 `lakesuperior.env_setup`.
-
-Context variables would be ideal: https://www.python.org/dev/peps/pep-0567/
-However they are only available in Python 3.7. Better keep an eye on that.
 '''
-env = threading.local()
+class Env:
+    pass
+
+env = Env()

+ 6 - 0
server.py

@@ -13,6 +13,12 @@ from lakesuperior.env import env
 from lakesuperior.app import create_app
 
 dictConfig(env.config['logging'])
+logger = logging.getLogger(__name__)
+
+logger.info('Graph store location: {}'.format(
+    env.config['application']['store']['ldp_rs']['location']))
+logger.info('Binary store location: {}'.format(
+    env.config['application']['store']['ldp_nr']['path']))
 
 fcrepo = create_app(env.config['application'])