summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-12-23 19:13:25 +0200
committerLars Wirzenius <liw@liw.fi>2020-12-23 19:13:25 +0200
commitc7bc29635624984aee3e620680a264fd32b27e50 (patch)
tree2741c71aab30827e833126e38f3fc31984abed68 /subplot
parent0967052ec4d6dfbd428a1c0027990f9c2610c040 (diff)
downloadobnam2-c7bc29635624984aee3e620680a264fd32b27e50.tar.gz
feat! let server address be configured
Instead of just specifying port, let the address (or name) be configured.
Diffstat (limited to 'subplot')
-rw-r--r--subplot/server.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/subplot/server.py b/subplot/server.py
index c4c01e1..7abe498 100644
--- a/subplot/server.py
+++ b/subplot/server.py
@@ -26,14 +26,19 @@ def start_chunk_server(ctx):
chunks = "chunks"
os.mkdir(chunks)
- config = {"chunks": chunks, "tls_key": "test.key", "tls_cert": "test.pem"}
- port = config["port"] = random.randint(2000, 30000)
+ port = random.randint(2000, 30000)
+ ctx["config"] = config = {
+ "chunks": chunks,
+ "tls_key": "test.key",
+ "tls_cert": "test.pem",
+ "address": f"localhost:{port}",
+ }
+
filename = "config.yaml"
yaml.safe_dump(config, stream=open(filename, "w"))
- logging.debug(f"Picked randomly port for obnam-server: {config['port']}")
- ctx["config"] = config
+ logging.debug(f"Picked randomly port for obnam-server: {config['address']}")
- ctx["server_url"] = f"https://localhost:{port}/chunks"
+ ctx["server_url"] = f"https://{config['address']}/chunks"
start_daemon(
ctx,