Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
took metadata functions and made them path endpoints instead of weird…
… subdomains. pulled them out into their own module as a wsgi app. bumped version
- Loading branch information
Showing
3 changed files
with
54 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
version_info = (0, 5, 8) | ||
version_info = (0, 6, 0) | ||
__version__ = ".".join(map(str, version_info)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import json | ||
import os | ||
|
||
from eventlet.wsgi import Server | ||
|
||
from localtunnel import __version__ | ||
from localtunnel.server.tunnel import Tunnel | ||
from localtunnel.server import metrics | ||
|
||
def root(environ, start_response): | ||
if environ['PATH_INFO'].startswith('/meta'): | ||
return meta(environ, start_response) | ||
else: | ||
start_response('200 OK', {}) | ||
return [""] | ||
|
||
def meta(environ, start_response): | ||
path = environ['PATH_INFO'] | ||
start_response('200 OK', {}) | ||
if path.startswith('/meta/version'): | ||
return [str(__version__)] | ||
elif path.startswith('/meta/backend'): | ||
return [str(os.environ.get('DOTCLOUD_SERVER_BACKEND_PORT', | ||
Tunnel.backend_port))] | ||
elif path.startswith('/meta/metrics'): | ||
return [json.dumps(metrics.dump_metrics(), | ||
sort_keys=True, indent=2, separators=(',', ': '))] | ||
|
||
|
||
|
||
server = Server(None, None, root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters