diff --git a/VERSION b/VERSION index a8ceee52..b1c34e29 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0+2025.01.02T16.11.54.892Z.0ba3c08e.berickson.requirements.cleanup +0.1.0+2025.04.14T14.58.15.3NZ.5aef220.dami.lms.pmss diff --git a/learning_observer/VERSION b/learning_observer/VERSION index f6be1883..b1c34e29 100644 --- a/learning_observer/VERSION +++ b/learning_observer/VERSION @@ -1 +1 @@ -0.1.0+2024.12.20T14.09.00.406Z.257bae3a.master +0.1.0+2025.04.14T14.58.15.3NZ.5aef220.dami.lms.pmss diff --git a/learning_observer/learning_observer/paths.py b/learning_observer/learning_observer/paths.py index 2dc505ca..94f2f201 100644 --- a/learning_observer/learning_observer/paths.py +++ b/learning_observer/learning_observer/paths.py @@ -29,6 +29,7 @@ import os import os.path import sys +import glob BASE_PATH = os.path.abspath(os.path.dirname(__file__)) @@ -87,6 +88,22 @@ def config_file(): return pathname +def get_school_config_files(): + ''' + Return a list of all .yaml config files in the specified directory. + Defaults to a 'configs' folder next to the base path. + ''' + school_config_dir = os.path.join(os.path.dirname(base_path()), 'school_configs') + + if not os.path.isdir(school_config_dir): + raise FileNotFoundError(f"Config directory not found: {school_config_dir}") + + school_config_files = glob.glob(os.path.join(school_config_dir, '*.yaml')) + + if not school_config_files: + print(f"No .yaml school configuration files found in: {school_config_dir}") + + return school_config_files DATA_PATH_OVERRIDE = None diff --git a/learning_observer/learning_observer/settings.py b/learning_observer/learning_observer/settings.py index 385d8a96..30db22f5 100644 --- a/learning_observer/learning_observer/settings.py +++ b/learning_observer/learning_observer/settings.py @@ -21,11 +21,19 @@ import pmss +school_config_paths = learning_observer.paths.get_school_config_files() +school_rulesets = [pmss.YAMLFileRuleset(filename=path) for path in school_config_paths] + +base_ruleset = pmss.YAMLFileRuleset(filename=learning_observer.paths.config_file()) + pmss_settings = pmss.init( prog=__name__, description="A system for monitoring", epilog="For more information, see PMSS documentation.", - rulesets=[pmss.YAMLFileRuleset(filename=learning_observer.paths.config_file())] + rulesets=[ + base_ruleset, + *school_rulesets + ] ) # If we e.g. `import settings` and `import learning_observer.settings`, we diff --git a/learning_observer/school_configs/school1.yaml b/learning_observer/school_configs/school1.yaml new file mode 100644 index 00000000..404e642a --- /dev/null +++ b/learning_observer/school_configs/school1.yaml @@ -0,0 +1,4 @@ +theme: + server_name: Learning Observer (School 1) +server: + port: 9990 \ No newline at end of file diff --git a/learning_observer/school_configs/school2.yaml b/learning_observer/school_configs/school2.yaml new file mode 100644 index 00000000..c2817825 --- /dev/null +++ b/learning_observer/school_configs/school2.yaml @@ -0,0 +1,4 @@ +theme: + server_name: Learning Observer (School 2) +server: + port: 9991 \ No newline at end of file