Skip to content

Commit

Permalink
Add simple command line interface to launch uvicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Oct 23, 2024
1 parent 971cd90 commit 23b9aa3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/galaxy/webapps/galaxy/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
from argparse import ArgumentParser

import uvicorn


def main() -> None:
parser = ArgumentParser(
prog="galaxy-web",
description="Run Galaxy Web Server",
)
parser.add_argument("--config", "-c", help="Galaxy config file")
parser.add_argument("--single-user", "-s", help="Single user mode as user SINGLE_USER")
parser.add_argument("--bind", "-b", default="localhost:8080", help="Bind to <host>:<port>")
parser.add_argument(
"--client-path", "-n", default="node_modules/@galaxyproject/galaxy-client", help="Path to Galaxy client"
)
args = parser.parse_args()
env = os.environ.copy()
if args.config:
env["GALAXY_CONFIG_FILE"] = args.config
if args.single_user:
env["GALAXY_CONFIG_SINGLE_USER"] = args.single_user
env["GALAXY_CONFIG_ADMIN_USERS"] = args.single_user
uvicorn.run(
"galaxy.webapps.galaxy.fast_factory:factory",
factory=True,
host=args.bind.split(":")[0],
port=int(args.bind.split(":")[1]),
)
4 changes: 4 additions & 0 deletions packages/web_apps/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ install_requires =
packages = find:
python_requires = >=3.8

[options.entry_points]
console_scripts =
galaxy-web = galaxy.webapps.galaxy.script:main

[options.packages.find]
exclude =
tests*
Expand Down

0 comments on commit 23b9aa3

Please sign in to comment.