diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-12-23 19:13:25 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-12-23 19:13:25 +0200 |
commit | c7bc29635624984aee3e620680a264fd32b27e50 (patch) | |
tree | 2741c71aab30827e833126e38f3fc31984abed68 /subplot | |
parent | 0967052ec4d6dfbd428a1c0027990f9c2610c040 (diff) | |
download | obnam2-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.py | 15 |
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, |