Skip to content

Commit

Permalink
Merge branch 'application-runner'
Browse files Browse the repository at this point in the history
* application-runner:
  router url from command line args
  bump version
  • Loading branch information
noisyboiler committed Oct 30, 2016
2 parents 238ba69 + d0baf30 commit 95e652e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='wampy',
version='0.4.2',
version='0.5.0',
description='WAMP RPC and Pub/Sub for python apps and microservices',
long_description=long_description,
url='https://github.com/noisyboiler/wampy',
Expand Down
15 changes: 9 additions & 6 deletions wampy/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import os
import sys
from urlparse import urlparse

import eventlet

Expand Down Expand Up @@ -55,14 +56,11 @@ def wait(self):
app.stop()


def run(app):
def run(app, host, port):
module_name, app_name = app[0].split(':')
mod = import_module(module_name)
app_class = getattr(mod, app_name)

# add to app args here
host = "localhost"
port = 8080
app = app_class(
name=app_class.__class__.__name__,
host=host,
Expand Down Expand Up @@ -95,7 +93,12 @@ def main(args):
sys.path.insert(0, '.')

app = args.application
run(app)
router_url = args.router
parsed_connection_details = urlparse(router_url)
host = parsed_connection_details.hostname
port = parsed_connection_details.port

run(app, host, port)


def init_parser(parser):
Expand All @@ -105,7 +108,7 @@ def init_parser(parser):
help='python path to one wampy application class to run')

parser.add_argument(
'--router', default='ws://localhost:8091',
'--router', default='http://localhost:8080',
help='WAMP router url')

return parser

0 comments on commit 95e652e

Please sign in to comment.