tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
3.09k stars 480 forks source link

tusd doesn't get or respect environment variables #1171

Closed mkabatek closed 2 months ago

mkabatek commented 3 months ago

Question

Hello I'm using docker compose to run a TUS server using tusd The only way I can get the parameters to configure the server is by passing them via command:

  tus:
    image: tusproject/tusd
    command: -verbose -s3-bucket fieldsync-files-dev -s3-endpoint http://localhost:4566 -port 1080 -host localhost
    ports:
      - "127.0.0.1:1080:1080"
    networks:
      - ls-net

However I'd like to configure the server using environment variables. So I have two questions:

  1. Where can I find an exhaustive list of environment variables used by tusd I've been trying to look through the source, but I don't see these in the source or docs. https://tus.github.io/tusd/getting-started/installation/#docker-container

  2. Ideally I'd like to pass configuration parameters using environment variables in the way I do for uppy however none of the following work, while they do work for uppy companion:

Passing via environment file

  tus:
    image: tusproject/tusd
    ports:
      - "127.0.0.1:1080:1080"
    env_file:
      - ./workspaces/backend/.env
    networks:
      - ls-net

Passing via environment

  tus:
    image: tusproject/tusd
    ports:
      - "127.0.0.1:1080:1080"
    environment:
      TUS_PORT: 1080
    networks:
      - ls-net

Passing via environment alternative

  tus:
    image: tusproject/tusd
    ports:
      - "127.0.0.1:1080:1080"
    environment:
      - "TUS_PORT=1080"
    networks:
      - ls-net
Acconut commented 3 months ago

Tusd cannot be configured through environment variables like Uppy's companion can; this is not supported. There is no TUSD_PORT environment variable. Instead, you have to use the CLI flags.

There is only a limited set of environment variables that tusd inspects for passing sensitive credentials for S3 etc.

mkabatek commented 3 months ago

@Acconut Thanks for your response.

There is only a limited set of environment variables that tusd inspects for passing sensitive credentials for S3 etc.

  1. Are these environment variables documented somewhere (aside from me searching the source)? If you could point me towards this documentation that would be awesome.
  2. Does the node implementation accept environment variables? Do you know?
Acconut commented 3 months ago
  1. Are these environment variables documented somewhere (aside from me searching the source)? If you could point me towards this documentation that would be awesome.

The variables are documented in the corresponding sections, such as

Besides those, the code also includes two variables that are not properly documented (because they are mainly used for internal debugging and testing):

image

2. Does the node implementation accept environment variables? Do you know?

I don't think so, but it's better to ask in its repository.

Acconut commented 2 months ago

Closing this issue due to inactivity. Feel free to leave a comment if you want to continue the discussion :)