mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +01:00
parent
39040c1874
commit
97e8258288
@ -39,6 +39,10 @@ class FrigateApp():
|
||||
self.log_queue = mp.Queue()
|
||||
self.camera_metrics = {}
|
||||
|
||||
def set_environment_vars(self):
|
||||
for key, value in self.config.environment_vars.items():
|
||||
os.environ[key] = value
|
||||
|
||||
def ensure_dirs(self):
|
||||
for d in [RECORD_DIR, CLIPS_DIR, CACHE_DIR]:
|
||||
if not os.path.exists(d) and not os.path.islink(d):
|
||||
@ -201,6 +205,7 @@ class FrigateApp():
|
||||
logger.error(f"Error parsing config: {e}")
|
||||
self.log_process.terminate()
|
||||
sys.exit(1)
|
||||
self.set_environment_vars()
|
||||
self.ensure_dirs()
|
||||
self.check_config()
|
||||
self.set_log_levels()
|
||||
|
@ -248,7 +248,8 @@ FRIGATE_CONFIG_SCHEMA = vol.Schema(
|
||||
vol.Optional('objects', default={}): OBJECTS_SCHEMA,
|
||||
vol.Optional('motion', default={}): MOTION_SCHEMA,
|
||||
vol.Optional('detect', default={}): DETECT_SCHEMA,
|
||||
vol.Required('cameras', default={}): CAMERAS_SCHEMA
|
||||
vol.Required('cameras', default={}): CAMERAS_SCHEMA,
|
||||
vol.Optional('environment_vars', default={}): { str: str }
|
||||
}
|
||||
)
|
||||
|
||||
@ -982,6 +983,7 @@ class FrigateConfig():
|
||||
self._snapshots = SnapshotsConfig(config['clips'])
|
||||
self._cameras = { name: CameraConfig(name, c, config) for name, c in config['cameras'].items() }
|
||||
self._logger = LoggerConfig(config['logger'])
|
||||
self._environment_vars = config['environment_vars']
|
||||
|
||||
def _sub_env_vars(self, config):
|
||||
frigate_env_vars = {k: v for k, v in os.environ.items() if k.startswith('FRIGATE_')}
|
||||
@ -1015,7 +1017,8 @@ class FrigateConfig():
|
||||
'clips': self.clips.to_dict(),
|
||||
'snapshots': self.snapshots.to_dict(),
|
||||
'cameras': {k: c.to_dict() for k, c in self.cameras.items()},
|
||||
'logger': self.logger.to_dict()
|
||||
'logger': self.logger.to_dict(),
|
||||
'environment_vars': self._environment_vars
|
||||
}
|
||||
|
||||
@property
|
||||
@ -1049,3 +1052,7 @@ class FrigateConfig():
|
||||
@property
|
||||
def cameras(self) -> Dict[str, CameraConfig]:
|
||||
return self._cameras
|
||||
|
||||
@property
|
||||
def environment_vars(self):
|
||||
return self._environment_vars
|
||||
|
Loading…
Reference in New Issue
Block a user