Skip to content

Commit ded6a5c

Browse files
committed
Manage Env Var to provide parameters
1 parent adf00fb commit ded6a5c

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ func setupSettings(adminPass string, confFile string) error {
5454
}
5555

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

6767
func main() {

readme.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,30 @@ and a chat only version at
124124
http://your.domain.host:8089/chat
125125
```
126126

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

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

144153
## Configuration

0 commit comments

Comments
 (0)