toniebox-reverse-engineering/teddycloud

Allow specifying port for webapp on command line

mrueg opened this issue · 8 comments

Currently teddycloud always starts listening on port 80, 443 and 8443. This will not work, if you have something listening on e.g. port 80 already.

It would be nice if a command line option or environment variable could be added to allow specifying the port(s) teddycloud should listen on.

443 is a must have (toniebox needs that)

the other two ports can be mapped as you like already. (At least in docker context)

Have a look onto these settings:

core.server.http_port

core.server.https_web_port

I believe they are accessible only through the config file. How can I set them in the command line?

You cannot set this via the cli. Everything is managed via the config file.

If you want to use a different directory for all teddyCloud files including the config you may use the option base_path.

What would be the business case for overriding it via cli?

Here's the reason why it would be nice to have it from the CLI:

  • It might not be run from a docker container or some place where you can easily map ports (e.g. docker container with host-network=true).
  • Port 80 and 8443 might be already in use, so you can't easily start it and access the webapp to alter the ports.

In this specific case, I'm building a home-assistant addon and I would like to allow the user to map it in the home assistant config and then alter the runtime arguments for the teddycloud binary instead of potentially messing with the users config (so ideally those arguments take priority over the config)

I would suggest that the cli takes config entries as argument and sets them during load, directly after loading the config file. This should work for most config entries especially for the ports.

That sounds like a great solution to me!

See develop

--config-set core.server.http_port=80,core.server.https_web_port=8443