allow keys to be passed in from env (again), cli to use LIVEKIT prefix

This commit is contained in:
David Zhao
2021-01-25 21:34:16 -08:00
parent 1f8bb57c92
commit bd81b073d1
3 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -28,12 +28,12 @@ var (
}
apiKeyFlag = &cli.StringFlag{
Name: "api-key",
EnvVars: []string{"LK_API_KEY"},
EnvVars: []string{"LIVEKIT_API_KEY"},
Required: true,
}
secretFlag = &cli.StringFlag{
Name: "api-secret",
EnvVars: []string{"LK_API_SECRET"},
EnvVars: []string{"LIVEKIT_API_SECRET"},
Required: true,
}
devFlag = &cli.BoolFlag{
+5
View File
@@ -42,6 +42,11 @@ func main() {
Name: "key-file",
Usage: "path to file that contains API keys/secrets",
},
&cli.StringFlag{
Name: "keys",
Usage: "api keys (key: secret\\n)",
EnvVars: []string{"LIVEKIT_KEYS"},
},
&cli.StringFlag{
Name: "redis-host",
Usage: "host (incl. port) to redis server",
+6
View File
@@ -64,6 +64,12 @@ func (conf *Config) UpdateFromCLI(c *cli.Context) error {
if c.IsSet("key-file") {
conf.KeyFile = c.String("key-file")
}
if c.IsSet("keys") {
keys := []byte(c.String("keys"))
if err := yaml.Unmarshal(keys, &conf.Keys); err != nil {
return err
}
}
if c.IsSet("redis-host") {
conf.Redis.Address = c.String("redis-host")
}