(
store: FeatureStore,
host: str,
port: int,
tls_key_path: str = "",
tls_cert_path: str = "",
)
| 589 | |
| 590 | |
| 591 | def start_server( |
| 592 | store: FeatureStore, |
| 593 | host: str, |
| 594 | port: int, |
| 595 | tls_key_path: str = "", |
| 596 | tls_cert_path: str = "", |
| 597 | ): |
| 598 | _init_auth_manager(store) |
| 599 | |
| 600 | tls_certificates = [] |
| 601 | scheme = "grpc+tcp" |
| 602 | if tls_key_path and tls_cert_path: |
| 603 | logger.info( |
| 604 | "Found SSL certificates in the args so going to start offline server in TLS(SSL) mode." |
| 605 | ) |
| 606 | scheme = "grpc+tls" |
| 607 | with open(tls_cert_path, "rb") as cert_file: |
| 608 | tls_cert_chain = cert_file.read() |
| 609 | with open(tls_key_path, "rb") as key_file: |
| 610 | tls_private_key = key_file.read() |
| 611 | tls_certificates.append((tls_cert_chain, tls_private_key)) |
| 612 | |
| 613 | location = "{}://{}:{}".format(scheme, host, port) |
| 614 | server = OfflineServer( |
| 615 | store, |
| 616 | location=location, |
| 617 | host=host, |
| 618 | tls_certificates=tls_certificates, |
| 619 | ) |
| 620 | try: |
| 621 | logger.info(f"Offline store server serving at: {location}") |
| 622 | server.serve() |
| 623 | except KeyboardInterrupt: |
| 624 | logger.info("KeyboardInterrupt received, stopping the offline server.") |
| 625 | finally: |
| 626 | server.shutdown() |
| 627 | logger.info("offline server stopped.") |
| 628 | sys.exit(0) |
nothing calls this directly
no test coverage detected