25 lines
705 B
Python
25 lines
705 B
Python
from __future__ import annotations
|
|
|
|
import importlib
|
|
import os
|
|
|
|
from packages.hub_runtime import SecretFileError, validate_required_secret_paths
|
|
|
|
from .dispatch import service_module
|
|
|
|
|
|
def main() -> None:
|
|
try:
|
|
validate_required_secret_paths(os.environ.get("REQUIRED_SECRET_FILES", ""))
|
|
except (SecretFileError, ValueError):
|
|
raise SystemExit("required runtime secret validation failed") from None
|
|
module = importlib.import_module(service_module(os.environ.get("SERVICE_NAME", "")))
|
|
runner = getattr(module, "run", None)
|
|
if not callable(runner):
|
|
raise SystemExit("configured service has no production runner")
|
|
runner()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|