Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAX_EXPIRE_SECONDS, MAX_DOWNLOADS, and MAX_FILE_SIZE env variables don't change UI dropdowns #33

Closed
pirate opened this issue May 18, 2021 · 4 comments · Fixed by timvisee/send-docker-compose#4 or #34

Comments

@pirate
Copy link

pirate commented May 18, 2021

Hi, thanks for maintaining this fork! Really appreciate it.


UPDATE: I figured it out, here's a final working config to allow up to 10GB uploaded for 5yr and 250k downloads.

services:
  send:
    ...
    environment:
      ...
      # these update both the backend limit and the limit shown/enforced in the UI
      - MAX_FILE_SIZE=10747904000
      - MAX_FILES_PER_ARCHIVE=1024
      
      # these update the UI dropdowns and should be a CSV of bare integers (first value is used as the dropdown default)
      - EXPIRE_TIMES_SECONDS=3600,86400,604800,2592000,31536000,157680000
      - DOWNLOAD_COUNTS=1,2,5,10,15,25,50,100,1000,10000,100000,250000
      
      # these are global limits enforced by the backend and have no effect on the UI
      - DEFAULT_EXPIRE_SECONDS=157680000
      - MAX_EXPIRE_SECONDS=315360000
      - MAX_DOWNLOADS=250000

image


Original ticket:

Changing MAX_EXPIRE_SECONDS, MAX_DOWNLOADS, and MAX_FILE_SIZE seems to have no effect on the UI when running with the latest Docker image, the dropdowns still only show the default maximums:

image

I know the environment variables are being read, because BASE_URL FILE_DIR are being set correctly when I change them.

Here is my docker-compose.yml config:

version: '3.9'

services:
  send:
    image: 'registry.gitlab.com/timvisee/send:latest'
    ports:
      - '1234:1234'
    volumes:
      - ./uploads:/uploads
    environment:
      - NODE_ENV=production
      - BASE_URL=https://send.example.com   # placeholder for my actual domain
      - PORT=1234
      - REDIS_HOST=redis
      - FILE_DIR=/uploads
      - MAX_EXPIRE_SECONDS=315360000       # 10 years
      - MAX_DOWNLOADS=200000               # 200k downloads
      - MAX_FILE_SIZE=10737418240          # 10 GB
      - ANON_MAX_EXPIRE_SECONDS=315360000
      - ANON_MAX_DOWNLOADS=20000
      - ANON_MAX_FILE_SIZE=10737418240

  redis:
    image: redis:alpine
    command: redis-server --appendonly yes
    volumes:
      - ./redis:/data

(based on https://github.com/timvisee/send-docker-compose/blob/master/docker-compose.yaml)

Versions:

@pirate
Copy link
Author

pirate commented May 18, 2021

Based on https://github.com/timvisee/send/blob/master/server/config.js it looks like I might have to set EXPIRE_TIMES_SECONDS to get the UI to change?

If that's the case, should the documentation + example compose file be updated to include these extra vars that need to be set to update the UI?

(also are the ANON_ prefixed settings still used or are those removed? if not, we should update the example config in timvisee/send-docker-compose)

@pirate
Copy link
Author

pirate commented May 19, 2021

I managed to increase it to 100k downloads and 365 days max, but I still cant get it to allow more than that no matter how I set the environment variables. It seems to ignore anything over those values, but I cant figure out where they're hardcoded.

This config should allow 1h, 1d, 1w, 1m, 1y, 5y, 250k downloads, and 10GB limits, but the UI doesn't show anything over 100,000 and 365 Days:

services:
  send:
    ...
    environment:
      ...      
      # Edit: (this is broken, see bottom of this comment for working version)
      - EXPIRE_TIMES_SECONDS="[3600, 86400, 604800, 2592000, 31536000, 157680000]"
      - DEFAULT_EXPIRE_SECONDS=157680000
      - MAX_EXPIRE_SECONDS=315360000
      - DOWNLOAD_COUNTS="[1, 2, 5, 10, 15, 25, 50, 100, 1000, 10000, 100000, 250000]"
      - MAX_DOWNLOADS=250000
      - MAX_FILES_PER_ARCHIVE=4096
      - MAX_ARCHIVES_PER_USER=4096
      - MAX_FILE_SIZE=10747904000

image

Edit: the config is making it to the frontend correctly in DEFAULTS, so something in the UI code is preventing the highest options from appearing in the dropdowns

image

Edit2: Aha! A clue here. I think the array config vars are parsed as CSV, not JSON. It's breaking the first and last values because of the [ and ].

image

@pirate
Copy link
Author

pirate commented May 19, 2021

Ok got it working. Changing the array config options to CSV values worked.

Here's the final working config to allow up to 10GB uploaded for 5yr and 250k downloads.

services:
  send:
    ...
    environment:
      ...
      # these update both the backend limit and the limit shown/enforced in the UI
      - MAX_FILE_SIZE=10747904000
      - MAX_FILES_PER_ARCHIVE=1024
      
      # these update the UI dropdowns and should be a CSV of bare integers (first value is used as the dropdown default)
      - EXPIRE_TIMES_SECONDS=3600,86400,604800,2592000,31536000,157680000
      - DOWNLOAD_COUNTS=1,2,5,10,15,25,50,100,1000,10000,100000,250000
      
      # these are global limits enforced by the backend and have no effect on the UI
      - DEFAULT_EXPIRE_SECONDS=157680000
      - MAX_EXPIRE_SECONDS=315360000
      - MAX_DOWNLOADS=250000

image

@pirate pirate changed the title MAX_EXPIRE_SECONDS, MAX_DOWNLOADS, and MAX_FILE_SIZE environment variables ignored MAX_EXPIRE_SECONDS, MAX_DOWNLOADS, and MAX_FILE_SIZE env variables don't change UI dropdowns May 19, 2021
@pirate
Copy link
Author

pirate commented May 19, 2021

Ok I opened 2 PRs to improve the docs and example configs:

You can probably close out this issue now, or wait till the final PR is merged, up to you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment