mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 00:52:17 +03:00
Read secrets dir from CREDENTIALS_DIRECTORY (#19327)
This supports systemd credentials, see https://systemd.io/CREDENTIALS/. Default to `/run/secrets` (the Docker Secrets dir) for backwards compatibility.
This commit is contained in:
@@ -5,12 +5,13 @@ from typing import Annotated
|
||||
from pydantic import AfterValidator, ValidationInfo
|
||||
|
||||
FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE_")}
|
||||
# read docker secret files as env vars too
|
||||
if os.path.isdir("/run/secrets") and os.access("/run/secrets", os.R_OK):
|
||||
for secret_file in os.listdir("/run/secrets"):
|
||||
secrets_dir = os.environ.get("CREDENTIALS_DIRECTORY", "/run/secrets")
|
||||
# read secret files as env vars too
|
||||
if os.path.isdir(secrets_dir) and os.access(secrets_dir, os.R_OK):
|
||||
for secret_file in os.listdir(secrets_dir):
|
||||
if secret_file.startswith("FRIGATE_"):
|
||||
FRIGATE_ENV_VARS[secret_file] = (
|
||||
Path(os.path.join("/run/secrets", secret_file)).read_text().strip()
|
||||
Path(os.path.join(secrets_dir, secret_file)).read_text().strip()
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user