Fix DCE token env var: v2.48 reads DISCORD_TOKEN, not TOKEN (both now set)

This commit is contained in:
2026-10-04 18:36:47 +02:00
parent 72ef7bc465
commit c8bb882d9d
+5 -2
View File
@@ -48,8 +48,9 @@ class FoundUrl:
def export_channel(channel_id: str, out_dir: Path, token: str, force: bool = False) -> Path:
"""Export the channel to out_dir/export.json using the DCE docker image.
The token is passed to the container via the TOKEN env var (DCE reads it
natively) so it never appears on the docker command line.
The token is passed to the container via the DISCORD_TOKEN env var (DCE
reads it natively) so it never appears on the docker command line. TOKEN
is set as well for DCE versions that only know that name.
"""
dest = out_dir / "export.json"
if dest.exists() and not force:
@@ -58,11 +59,13 @@ def export_channel(channel_id: str, out_dir: Path, token: str, force: bool = Fal
out_dir.mkdir(parents=True, exist_ok=True)
env = dict(os.environ)
env["DISCORD_TOKEN"] = token
env["TOKEN"] = token
cmd = [
"docker", "run", "--rm",
"--user", f"{os.getuid()}:{os.getgid()}",
"-v", f"{out_dir.resolve()}:/out",
"-e", "DISCORD_TOKEN",
"-e", "TOKEN",
DCE_IMAGE,
"export", "-c", channel_id, "-f", "Json", "-o", "/out/export.json",