Skip to content

Commit

Permalink
feat: 🎉 Add MAX_CONTENT_LENGTH configuration for file uploads (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
albinmedoc authored Aug 3, 2024
1 parent 3de4467 commit 2edf951
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/wizarr-backend/wizarr_backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from os import environ, path
from flask import Flask
from app.security import secret_key, SchedulerAuth
from definitions import DATABASE_DIR
from definitions import DATABASE_DIR, MAX_CONTENT_LENGTH

def create_config(app: Flask):
config = {}
Expand Down Expand Up @@ -30,5 +30,6 @@ def create_config(app: Flask):
config["SCHEDULER_API_ENABLED"] = True
config["SCHEDULER_API_PREFIX"] = "/api/scheduler"
config["SCHEDULER_AUTH"] = SchedulerAuth()
config["MAX_CONTENT_LENGTH"] = MAX_CONTENT_LENGTH

return config
1 change: 1 addition & 0 deletions apps/wizarr-backend/wizarr_backend/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
ROOT_DIR = getenv("ROOT_DIR", path.abspath(path.join(path.abspath(__file__), "../")))
LATEST_FILE = getenv("LATEST_FILE", path.join(ROOT_DIR, "../", "../", "../", "latest"))
DATABASE_DIR = getenv("DATABASE_DIR", path.join(ROOT_DIR, "../", "database"))
MAX_CONTENT_LENGTH = getenv("MAX_CONTENT_LENGTH", 5 * 1024 * 1024) # 5MB
2 changes: 2 additions & 0 deletions files/nginx-backend.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ server {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization';

client_max_body_size 0; # Disables limit, relying on Flask's MAX_CONTENT_LENGTH

location /api {
proxy_pass http://127.0.0.1:5000;
# proxy_set_header Host $host;
Expand Down

0 comments on commit 2edf951

Please sign in to comment.