Initialize global variables from environment or command line args if not already set.
()
| 32 | MODULE_TREE = None |
| 33 | |
| 34 | def initialize_globals(): |
| 35 | """Initialize global variables from environment or command line args if not already set.""" |
| 36 | global DOCS_FOLDER, MODULE_TREE |
| 37 | |
| 38 | if DOCS_FOLDER is None: |
| 39 | # Try to get from environment variable or use a default |
| 40 | import os |
| 41 | docs_folder_path = os.environ.get('DOCS_FOLDER') |
| 42 | if docs_folder_path and Path(docs_folder_path).exists(): |
| 43 | DOCS_FOLDER = docs_folder_path |
| 44 | MODULE_TREE = load_module_tree(Path(docs_folder_path)) |
| 45 | else: |
| 46 | # If no environment variable, we need to handle this gracefully |
| 47 | # The FastAPI endpoints will need to check if DOCS_FOLDER is None |
| 48 | pass |
| 49 | |
| 50 | # Markdown parser |
| 51 | md = MarkdownIt() |
no test coverage detected