summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lwirzenius@wikimedia.org>2019-04-18 13:39:14 -0500
committerLars Wirzenius <lwirzenius@wikimedia.org>2019-04-18 13:39:14 -0500
commitc6afe5d6597d3648bc1c6bc2e25102cad05b2227 (patch)
treef5f7675c87bce0e4e99793114f24b64088e86b95
parentf9ba0c8565763cc185d2fbe94bb0296d845f210e (diff)
downloadmuck-poc-c6afe5d6597d3648bc1c6bc2e25102cad05b2227.tar.gz
Add: optional port config setting for port to listen on
Defaults to the old 12765 port number.
-rwxr-xr-xmuck_poc6
-rw-r--r--yarns/lib.py3
2 files changed, 6 insertions, 3 deletions
diff --git a/muck_poc b/muck_poc
index 0e37c41..e0b1729 100755
--- a/muck_poc
+++ b/muck_poc
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# Copyright (C) 2018 Lars Wirzenius
+# Copyright (C) 2018-2019 Lars Wirzenius
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@@ -250,6 +250,8 @@ if config.get('pid'):
with open(config['pid'], 'w') as f:
f.write(str(pid))
+port = config.get('port', 12765)
+
app = bottle.default_app()
api = MuckAPI(app, store, signing_key_text)
-bottle.run(host='127.0.0.1', port=12765)
+bottle.run(host='127.0.0.1', port=port)
diff --git a/yarns/lib.py b/yarns/lib.py
index f64af8d..3293a5d 100644
--- a/yarns/lib.py
+++ b/yarns/lib.py
@@ -41,6 +41,7 @@ def start_muck():
config = {
'pid': 'muck.pid',
+ 'port': 9999,
'log': 'muck.log',
'store': datadir,
'signing-key-filename': pubkey,
@@ -58,7 +59,7 @@ def start_muck():
]
subprocess.check_call(argv)
time.sleep(2)
- V['base_url'] = 'http://127.0.0.1:{}'.format(12765)
+ V['base_url'] = 'http://127.0.0.1:{}'.format(config['port'])
def stop_muck():