mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix config loading (#14684)
This commit is contained in:
parent
bb80a7b2ee
commit
ab26aee8b2
@ -67,7 +67,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
yaml = YAML()
|
yaml = YAML()
|
||||||
|
|
||||||
DEFAULT_CONFIG_FILES = ["/config/config.yaml", "/config/config.yml"]
|
DEFAULT_CONFIG_FILE = "/config/config.yml"
|
||||||
DEFAULT_CONFIG = """
|
DEFAULT_CONFIG = """
|
||||||
mqtt:
|
mqtt:
|
||||||
enabled: False
|
enabled: False
|
||||||
@ -634,20 +634,16 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, **kwargs):
|
def load(cls, **kwargs):
|
||||||
config_path = os.environ.get("CONFIG_FILE")
|
config_path = os.environ.get("CONFIG_FILE", DEFAULT_CONFIG_FILE)
|
||||||
|
|
||||||
# No explicit configuration file, try to find one in the default paths.
|
if not os.path.isfile(config_path):
|
||||||
if config_path is None:
|
config_path = config_path.replace("yml", "yaml")
|
||||||
for path in DEFAULT_CONFIG_FILES:
|
|
||||||
if os.path.isfile(path):
|
|
||||||
config_path = path
|
|
||||||
break
|
|
||||||
|
|
||||||
# No configuration file found, create one.
|
# No configuration file found, create one.
|
||||||
new_config = False
|
new_config = False
|
||||||
if config_path is None:
|
if not os.path.isfile(config_path):
|
||||||
logger.info("No config file found, saving default config")
|
logger.info("No config file found, saving default config")
|
||||||
config_path = DEFAULT_CONFIG_FILES[-1]
|
config_path = DEFAULT_CONFIG_FILE
|
||||||
new_config = True
|
new_config = True
|
||||||
else:
|
else:
|
||||||
# Check if the config file needs to be migrated.
|
# Check if the config file needs to be migrated.
|
||||||
|
Loading…
Reference in New Issue
Block a user