File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,16 @@ func (h *Handler) prepareMux() *http.ServeMux {
187187}
188188
189189func readKeySecret () (string , string ) {
190+ // We initialize keys & secrets from environment variables
190191key := os .Getenv ("LIVEKIT_KEY" )
191192secret := os .Getenv ("LIVEKIT_SECRET" )
193+ // We initialize potential key & secret path from environment variables
192194key_path := os .Getenv ("LIVEKIT_KEY_FROM_FILE" )
193195secret_path := os .Getenv ("LIVEKIT_SECRET_FROM_FILE" )
194196key_secret_path := os .Getenv ("LIVEKIT_KEY_FILE" )
197+
198+ // If key_secret_path is set we read the file and split it into two parts
199+ // It takes over any other initialization
195200if key_secret_path != "" {
196201if keySecretBytes , err := os .ReadFile (key_secret_path ); err != nil {
197202log .Fatal (err )
@@ -204,6 +209,8 @@ func readKeySecret() (string, string) {
204209secret = key_secrets [1 ]
205210}
206211} else {
212+ // If key_secret_path, we try to read the key and secret from files
213+ // If those files are not set, we return the key & secret from the environment variables
207214if key_path != "" {
208215if keyBytes , err := os .ReadFile (key_path ); err != nil {
209216log .Fatal (err )
You can’t perform that action at this time.
0 commit comments