Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var/
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
Expand Down Expand Up @@ -63,3 +63,6 @@ target/

# known_hosts file
known_hosts

# vcode
.vscode/
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
paramiko==2.7.1
tornado==5.1.1; python_version < '3.5'
tornado==6.0.4; python_version >= '3.5'
tornado-prometheus==0.1.1
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
],
install_requires=[
'tornado>=4.5.0',
'tornado-prometheus>=0.1.1',
'paramiko>=2.3.1',
],
)
9 changes: 7 additions & 2 deletions webssh/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
get_app_settings, get_host_keys_settings, get_policy_setting,
get_ssl_context, get_server_settings, check_encoding_setting
)
from tornado_prometheus import PrometheusMixIn, MetricsHandler


def make_handlers(loop, options):
Expand All @@ -18,14 +19,18 @@ def make_handlers(loop, options):
handlers = [
(r'/', IndexHandler, dict(loop=loop, policy=policy,
host_keys_settings=host_keys_settings)),
(r'/ws', WsockHandler, dict(loop=loop))
(r'/ws', WsockHandler, dict(loop=loop)),
(r"/metrics", MetricsHandler)
]
return handlers


def make_app(handlers, settings):
class WebsshApplication(PrometheusMixIn, tornado.web.Application):
pass

settings.update(default_handler_class=NotFoundHandler)
return tornado.web.Application(handlers, **settings)
return WebsshApplication(handlers, **settings)


def app_listen(app, port, address, server_settings):
Expand Down