File size: 781 Bytes
2e658e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
"""Fail-fast startup configuration gate for the deployed overlay."""
from __future__ import annotations

import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
for candidate in (ROOT / "hermes_overlay", Path("/opt/hermesface_overlay"), Path("/opt/hermes")):
    if candidate.is_dir():
        sys.path.insert(0, str(candidate))

from trading.config_validation import ConfigurationError, assert_safe_for_startup  # noqa: E402


def main() -> int:
    try:
        assert_safe_for_startup()
    except ConfigurationError as exc:
        print(f"ERROR: unsafe startup configuration: {exc}", file=sys.stderr)
        return 1
    print("startup_configuration=PASS")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())