add support for docker secrets (#8409)

* add support for docker secrets

* check for directory first
This commit is contained in:
Blake Blackshear
2023-11-02 10:35:30 +00:00
committed by GitHub
parent 4bd29b2ee8
commit 0dd3dd23aa
5 changed files with 26 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import json
import logging
import os
import re
from pathlib import Path
from typing import Any, List
import cv2
@@ -36,6 +37,10 @@ class PlusApi:
self.key = None
if PLUS_ENV_VAR in os.environ:
self.key = os.environ.get(PLUS_ENV_VAR)
elif os.path.isdir("/run/secrets") and PLUS_ENV_VAR in os.listdir(
"/run/secrets"
):
self.key = Path(os.path.join("/run/secrets", PLUS_ENV_VAR)).read_text()
# check for the addon options file
elif os.path.isfile("/data/options.json"):
with open("/data/options.json") as f: