Skip to content

Commit

Permalink
Manage Env Var to provide parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
zorglube committed Mar 1, 2023
1 parent adf00fb commit ded6a5c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ func setupSettings(adminPass string, confFile string) error {
}

type args struct {
Addr string `arg:"-l,--addr" help:"host:port of the HTTP server"`
RtmpAddr string `arg:"-r,--rtmp" help:"host:port of the RTMP server"`
StreamKey string `arg:"-k,--key" help:"Stream key, to protect your stream"`
AdminPass string `arg:"-a,--admin" help:"Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json."`
ConfigFile string `arg:"-f,--config" help:"URI of the conf file"`
StaticDir string `arg:"-s,--static" help:"Directory to read static files from by default"`
EmotesDir string `arg:"-e,--emotes" help:"Directory to read emotes. By default it uses the executable directory"`
WriteStatic bool `arg:"--write-static" help:"write static files to the static dir"`
Addr string `arg:"-l,--addr,env:MN_ADDR" help:"host:port of the HTTP server"`
RtmpAddr string `arg:"-r,--rtmp,env:MN_RTMP" help:"host:port of the RTMP server"`
StreamKey string `arg:"-k,--key,env:MN_STREAM_KEY" help:"Stream key, to protect your stream"`
AdminPass string `arg:"-a,--admin,env:MN_ADMIN_PASS" help:"Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json."`
ConfigFile string `arg:"-f,--config,env:MN_CONFIG" help:"URI of the conf file"`
StaticDir string `arg:"-s,--static,env:MN_STATIC" help:"Directory to read static files from by default"`
EmotesDir string `arg:"-e,--emotes,env:MN_EMOTES" help:"Directory to read emotes. By default it uses the executable directory"`
WriteStatic bool `arg:"--write-static,env:MN_WRITE_STATIC" help:"write static files to the static dir"`
}

func main() {
Expand Down
35 changes: 22 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,30 @@ and a chat only version at
http://your.domain.host:8089/chat
```

The default listen port is `:8089`. It can be changed by providing a new port
at startup:
Some configurations values can be provided by three ways environment variables, run args, settings.json file.

```text
Usage of .\MovieNight.exe:
-e bool
Whether or not to download approved emotes on startup (default "false")
-k string
Stream key, to protect your stream (default: "")
-l string
host:port of the MovieNight (default ":8089")
-r string
host:port of the RTMP server (default ":1935")
-f string
the settings file you want to use (default "./settings.json")
Usage: MovieNight.exe [--addr ADDR] [--rtmp RTMP] [--key KEY] [--admin ADMIN] [--config CONFIG] [--static STATIC] [--emotes EMOTES] [--write-static]
Options:
--addr ADDR, -l ADDR
host:port of the HTTP server [env: MN_ADDR]
--rtmp RTMP, -r RTMP
host:port of the RTMP server [env: MN_RTMP]
--key KEY, -k KEY
Stream key, to protect your stream [env: MN_STREAM_KEY]
--admin ADMIN, -a ADMIN
Set admin password. Overrides configuration in settings.json. This will not write the password to settings.json. [env: MN_ADMIN_PASS]
--config CONFIG, -f CONFIG
URI of the conf file [env: MN_CONFIG]
--static STATIC, -s STATIC
Directory to read static files from by default [env: MN_STATIC]
--emotes EMOTES, -e EMOTES
Directory to read emotes. By default it uses the executable directory [env: MN_EMOTES]
--write-static
write static files to the static dir
--help, -h
display this help and exit
```

## Configuration
Expand Down

0 comments on commit ded6a5c

Please sign in to comment.