mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 16:16:48 +00:00
fix: docsgpt up review follow-ups
- wait_healthy starts no request once the deadline is reached, and neither its pauses nor the requests after the first run past it; the first attempt still always runs (status uses a zero timeout). - envfile writes $ as $$ inside double quotes, which Compose interpolates, and reads $$ back as $, so a value such as pa$w'rd reaches the container unchanged. - Upgrading no longer describes the working directory as the data home.
This commit is contained in:
1 parent
5e699b0168
commit
f6bf4fefd1
5 files changed
+64
-10
No files matched your search
@@ -19,19 +19,21 @@ def _parse_value(raw: str) -> str:
|
||||
if len(value) >= 2 and value[0] == value[-1] == "'":
|
||||
return value[1:-1]
|
||||
if len(value) >= 2 and value[0] == value[-1] == '"':
|
||||
return re.sub(r'\\(["\\])', r"\1", value[1:-1])
|
||||
return re.sub(r'\\(["\\])', r"\1", value[1:-1]).replace("$$", "$")
|
||||
return value.split(" #", 1)[0].rstrip()
|
||||
|
||||
|
||||
def _format_value(value: str) -> str:
|
||||
"""``value`` quoted so it reads back unchanged."""
|
||||
"""``value`` quoted so it reads back unchanged, and so Compose passes it on unchanged."""
|
||||
if "\n" in value or "\r" in value:
|
||||
raise ValueError("a .env value cannot contain a newline")
|
||||
if _PLAIN.match(value):
|
||||
return value
|
||||
if "'" not in value:
|
||||
# Compose does not interpolate single-quoted values.
|
||||
return f"'{value}'"
|
||||
return '"' + value.replace("\\", "\\\\").replace('"', '\\"') + '"'
|
||||
# Double quotes are interpolated: $$ is Compose's literal dollar.
|
||||
return '"' + value.replace("\\", "\\\\").replace('"', '\\"').replace("$", "$$") + '"'
|
||||
|
||||
|
||||
def read(path: Path) -> dict[str, str]:
|
||||
|
||||
Reference in new issue
Block a user