jaredpetersen / raspilive

📷 Stream video from the Raspberry Pi Camera Module to the web
MIT License
145 stars 33 forks source link

Configuration Refactor #40

Closed jaredpetersen closed 3 years ago

jaredpetersen commented 4 years ago

We've pretty much reached the limits of the current CLI argument structure.

Instead of having one start command, we should have a stream-hls and a stream-dash command with separate options (but obviously there would be overlap). Options should stop using single character shorthands because we're running out of characters to use that make any kind of sense for the option they configure.

Alternatively, we might want to just get rid of the CLI entirely. Running raspi-live would start the server and it would look at the environment variables or a particular config file for its configuration. I'm not sure how popular this would be though and definitely welcome feedback.

jaredpetersen commented 3 years ago

This configuration refactor will probably take the form of environment variables. We're closer to an actual application than a CLI utility so configuration using a more traditional method like environment variables might be more appropriate.

Ideally, you'd still get a help screen with information if you don't provide anything so that it's not a total black box.

The README of the rewrite branch, golang-rewrite has a draft of what the environment variable strategy would look like.

I'm still very much waffling though and am open to what the community wants. I think part of the success of project is owed to the user-friendliness of the CLI argument style of configuration and using environment variables inline is not so pretty:

RASPILIVE_MODE=dash RASPILIVE_DASH_PORT=8080 raspilive

Although you should be setting this up in systemd anyways so in theory you wouldn't be interacting with it much after you know what configuration you need.

The alternative for sticking with an argument approach would look like the following:

raspilive hls --width 1920 --height 1080 --segment-type fmp4 --port 8080
raspilive dash --port 8080
raspilive rtmp --remote http://example.com

This is friendlier from a tinkering and frequent usage perspective but I don't think that's what people are using this for. I imagine it's more of a set it and forget it sort of usage pattern.

jaredpetersen commented 3 years ago

Opted to go with the CLI approach for better user experience. This has been implemented in the go-rewrite branch.