Skip to content

Commit

Permalink
make it possible to set a custom host and port in bfabric_flask.py
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Jul 9, 2024
1 parent 1b52c16 commit 4da5366
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bfabric/scripts/bfabric_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"""

from __future__ import annotations

import argparse
import os
import json
import logging
Expand Down Expand Up @@ -298,6 +300,11 @@ def setup_logger_debug(name: str = DEFAULT_LOGGER_NAME) -> None:

def main() -> None:
"""Starts the server, auto-detecting production mode if SSL keys are present."""
parser = argparse.ArgumentParser()
parser.add_argument("--host", default="127.0.0.1", type=str)
parser.add_argument("--port", default=5000, type=int)
args = parser.parse_args()

ssl_key_pub = Path("/etc/ssl/fgcz-host.pem")
ssl_key_priv = Path("/etc/ssl/private/fgcz-host_key.pem")
if ssl_key_pub.exists() and ssl_key_priv.exists():
Expand All @@ -313,7 +320,7 @@ def main() -> None:
)
else:
setup_logger_debug()
app.run(debug=False, host="127.0.0.1", port=5000)
app.run(debug=False, host=args.host, port=args.port)


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Versioning currently follows `X.Y.Z` where
### Added

- Add `bfabric.entities.Dataset` to easily read datasets.
- Make host and port configurable in `bfabric_flask.py` (currently only dev mode).

## \[1.13.1\] - 2024-07-02

Expand Down

0 comments on commit 4da5366

Please sign in to comment.