From 49c3f72fa0f9f68e463d8a883b3d1786ec4c0768 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 26 Jan 2026 13:52:57 -0600 Subject: Replace TEMPORARY_DIRECTORY with SCRATCH_DIRECTORY Avoid using the terminology "TEMPORARY_DIRECTORY" which encourages use of the shared global mutable state in /tmp, that we want to move away from. Instead, we use "SCRATCH_DIRECTORY" which is an explicit specified directory for state needed for and by the gn-uploader application. --- uploader/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'uploader/__init__.py') diff --git a/uploader/__init__.py b/uploader/__init__.py index 0ba1f81..a28ed8d 100644 --- a/uploader/__init__.py +++ b/uploader/__init__.py @@ -73,6 +73,14 @@ def setup_modules_logging(app_logger, modules): _logger.setLevel(loglevel) +def __setup_scratch_directory__(app: Flask) -> Flask: + app.config["SCRATCH_DIRECTORY"] = Path( + app.config["SCRATCH_DIRECTORY"]).absolute() + return app + +def update_unspecified_defaults(app: Flask): + """Setup the defaults for necessary configurations that do not have values specified for them.""" + __setup_scratch_directory__(app) def create_app(config: Optional[dict] = None): """The application factory. @@ -100,6 +108,7 @@ def create_app(config: Optional[dict] = None): # Silently ignore secrets if the file does not exist. app.config.from_pyfile(secretsfile) app.config.update(config) # Override everything with passed in config + update_unspecified_defaults(app) ### END: Application configuration app.config["SESSION_CACHELIB"] = FileSystemCache( -- cgit 1.4.1