mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-27 21:42:01 -08:00
return an error in case configuration file can't be opened (#1920)
This commit is contained in:
parent
04e342a110
commit
083151360e
1 changed files with 2 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ package conf
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
|
|
@ -43,7 +44,7 @@ func loadFromFile(fpath string, conf *Conf) (bool, error) {
|
|||
// mediamtx.yml is optional
|
||||
// other configuration files are not
|
||||
if fpath == "mediamtx.yml" || fpath == "rtsp-simple-server.yml" {
|
||||
if _, err := os.Stat(fpath); err != nil {
|
||||
if _, err := os.Stat(fpath); errors.Is(err, os.ErrNotExist) {
|
||||
conf.UnmarshalJSON(nil) // load defaults
|
||||
return false, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue