Skip to content

Commit

Permalink
Merge branch 'blakeblackshear:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
weitheng authored Oct 30, 2024
2 parents fee8a52 + ab26aee commit e901371
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions frigate/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

yaml = YAML()

DEFAULT_CONFIG_FILES = ["/config/config.yaml", "/config/config.yml"]
DEFAULT_CONFIG_FILE = "/config/config.yml"
DEFAULT_CONFIG = """
mqtt:
enabled: False
Expand Down Expand Up @@ -651,20 +651,16 @@ def ensure_zones_and_cameras_have_different_names(cls, v: Dict[str, CameraConfig

@classmethod
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 config_path is None:
for path in DEFAULT_CONFIG_FILES:
if os.path.isfile(path):
config_path = path
break
if not os.path.isfile(config_path):
config_path = config_path.replace("yml", "yaml")

# No configuration file found, create one.
new_config = False
if config_path is None:
if not os.path.isfile(config_path):
logger.info("No config file found, saving default config")
config_path = DEFAULT_CONFIG_FILES[-1]
config_path = DEFAULT_CONFIG_FILE
new_config = True
else:
# Check if the config file needs to be migrated.
Expand Down

0 comments on commit e901371

Please sign in to comment.