Fix DCE token env var: v2.48 reads DISCORD_TOKEN, not TOKEN (both now set)
This commit is contained in:
@@ -48,8 +48,9 @@ class FoundUrl:
|
|||||||
def export_channel(channel_id: str, out_dir: Path, token: str, force: bool = False) -> Path:
|
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.
|
"""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
|
The token is passed to the container via the DISCORD_TOKEN env var (DCE
|
||||||
natively) so it never appears on the docker command line.
|
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"
|
dest = out_dir / "export.json"
|
||||||
if dest.exists() and not force:
|
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)
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
|
env["DISCORD_TOKEN"] = token
|
||||||
env["TOKEN"] = token
|
env["TOKEN"] = token
|
||||||
cmd = [
|
cmd = [
|
||||||
"docker", "run", "--rm",
|
"docker", "run", "--rm",
|
||||||
"--user", f"{os.getuid()}:{os.getgid()}",
|
"--user", f"{os.getuid()}:{os.getgid()}",
|
||||||
"-v", f"{out_dir.resolve()}:/out",
|
"-v", f"{out_dir.resolve()}:/out",
|
||||||
|
"-e", "DISCORD_TOKEN",
|
||||||
"-e", "TOKEN",
|
"-e", "TOKEN",
|
||||||
DCE_IMAGE,
|
DCE_IMAGE,
|
||||||
"export", "-c", channel_id, "-f", "Json", "-o", "/out/export.json",
|
"export", "-c", channel_id, "-f", "Json", "-o", "/out/export.json",
|
||||||
|
|||||||
Reference in New Issue
Block a user