Skip to content

Paths service

consortium.server.services.paths_service

PathsService()

Central registry of the filesystem paths the server depends on.

Resolves and holds every well-known file and directory path relative to the consortium project root, so that other services resolve paths through this single service rather than recomputing them. Construction only resolves paths, it performs no filesystem validation. Call _run_preflight_path_validations once, at server boot, to validate that the required files exist and to auto-create any missing expected directories, aborting server startup if a path is in an unrecoverable status.

Attributes:

Name Type Description
consortium_root Path

The project root directory, resolved as the ancestor three levels above this service's module file.

release_json_file Path

The release metadata JSON file under data. Its existence is validated by _run_preflight_path_validations.

server_config_json_file Path

The server configuration JSON file under data/server. Not preflight-validated by this service: it is read directly by start_server.py before this service is usable, so kept here only so plugins and components have a single place to resolve it.

logging_config_json_file Path

The logging configuration JSON file under data/server. Not preflight-validated by this service, for the same reason as server_config_json_file above.

user_accounts_json_file Path

The user accounts JSON file under data/server. Its existence is validated by _run_preflight_path_validations.

role_permissions_json_file Path

The role permissions JSON file under data/server. Its existence is validated by _run_preflight_path_validations.

server_logs_directory Path

The directory under data/server where server log files are written.

assets_directory Path

The directory under data/server where asset resources are stored.

artifacts_directory Path

The directory under data/server where artifact resources are stored.

payloads_directory Path

The directory under data/server where payload resources are stored.

components_directory Path

The consortium/components directory holding user-created components that extend the framework.

listeners_directory Path

The listeners subdirectory of the components directory.

agents_directory Path

The agents subdirectory of the components directory.

plugins_directory Path

The plugins subdirectory of the components directory.

event_hooks_directory Path

The event hooks subdirectory of the components directory.

Raises:

Type Description
ConsortiumUserAccountsFileSystemError

If, when _run_preflight_path_validations is called, the user accounts file does not exist at user_accounts_json_file, is a directory, or cannot otherwise be confirmed present.

ConsortiumRolePermissionsFileSystemError

If, when _run_preflight_path_validations is called, the role permissions file does not exist at role_permissions_json_file, is a directory, or cannot otherwise be confirmed present.

ConsortiumReleaseFileSystemError

If, when _run_preflight_path_validations is called, the release file does not exist at release_json_file, is a directory, or cannot otherwise be confirmed present.

ConsortiumDirectoryFileSystemError

If, when _run_preflight_path_validations is called, one of the expected directories cannot be created, or a file exists at the path of one of the expected directories instead of a directory.

consortium_root = pathlib.Path(__file__).resolve().parents[3] instance-attribute

release_json_file = self.consortium_root / 'data' / 'release.json' instance-attribute

server_config_json_file = self.consortium_root / 'data' / 'server' / 'server_config.json' instance-attribute

logging_config_json_file = self.consortium_root / 'data' / 'server' / 'logging_config.json' instance-attribute

user_accounts_json_file = self.consortium_root / 'data' / 'server' / 'user_accounts.json' instance-attribute

role_permissions_json_file = self.consortium_root / 'data' / 'server' / 'role_permissions.json' instance-attribute

server_logs_directory = self.consortium_root / 'data' / 'server' / 'logs' instance-attribute

assets_directory = self.consortium_root / 'data' / 'server' / 'assets' instance-attribute

artifacts_directory = self.consortium_root / 'data' / 'server' / 'artifacts' instance-attribute

payloads_directory = self.consortium_root / 'data' / 'server' / 'payloads' instance-attribute

components_directory = self.consortium_root / 'consortium' / 'components' instance-attribute

listeners_directory = self.components_directory / 'listeners' instance-attribute

agents_directory = self.components_directory / 'agents' instance-attribute

plugins_directory = self.components_directory / 'plugins' instance-attribute

event_hooks_directory = self.components_directory / 'event_hooks' instance-attribute