Skip to content

Commit

Permalink
Merge pull request #112 from wasade/runner
Browse files Browse the repository at this point in the history
Very simple CLI to start server
  • Loading branch information
wasade committed Apr 22, 2020
2 parents 151c051 + 4ee6146 commit d419936
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
11 changes: 7 additions & 4 deletions microsetta_private_api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ def reroute_americangut(filename):
return app


# If we're running in stand alone mode, run the application
if __name__ == '__main__':
app = build_app()

def run(app):
if SERVER_CONFIG["ssl_cert_path"] and SERVER_CONFIG["ssl_key_path"]:
ssl_context = (
SERVER_CONFIG["ssl_cert_path"], SERVER_CONFIG["ssl_key_path"]
Expand All @@ -72,3 +69,9 @@ def reroute_americangut(filename):
debug=SERVER_CONFIG['debug'],
ssl_context=ssl_context
)


# If we're running in stand alone mode, run the application
if __name__ == '__main__':
app = build_app()
run(app)
8 changes: 8 additions & 0 deletions mpa_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import click
from microsetta_private_api.server import build_app, run


@click.command()
def cli():
app = build_app()
run(app)
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
packages=find_packages(),
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
py_modules=['mpa-cli'],
url="https://github.com/biocore/microsetta-private-api",
description="A RESTful API to support The Microsetta Initiative",
license='BSD-3-Clause',
Expand All @@ -41,4 +42,8 @@
'static/vendor/bootstrap-3.3.7-dist/fonts/*',
'authrocket.pubkey'
]},
entry_points='''
[console_scripts]
mpa-cli=mpa_cli:cli
'''
)

0 comments on commit d419936

Please sign in to comment.