mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	runtusd: Respect application_server.nginx_listen_port.
In deploys `nginx_listen_port` set, tusd would fail to send its hook requests, as it assumed that nginx would always be listening on 127.0.0.1:80. Set the `nginx_listen_port` on the hook URL, if necessary.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							b4fb22ba1b
						
					
				
				
					commit
					bee3c6eb59
				
			@@ -6,6 +6,8 @@ from django.conf import settings
 | 
				
			|||||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
 | 
					from django.core.management.base import BaseCommand, CommandError, CommandParser
 | 
				
			||||||
from typing_extensions import override
 | 
					from typing_extensions import override
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from scripts.lib.zulip_tools import get_config, get_config_file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Command(BaseCommand):
 | 
					class Command(BaseCommand):
 | 
				
			||||||
    help = """Starts the tusd server"""
 | 
					    help = """Starts the tusd server"""
 | 
				
			||||||
@@ -15,10 +17,16 @@ class Command(BaseCommand):
 | 
				
			|||||||
        parser.add_argument(
 | 
					        parser.add_argument(
 | 
				
			||||||
            "listen", help="[Port, or address:port, to bind HTTP server to]", type=str
 | 
					            "listen", help="[Port, or address:port, to bind HTTP server to]", type=str
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        local_port = 80
 | 
				
			||||||
 | 
					        config_file = get_config_file()
 | 
				
			||||||
 | 
					        if get_config(config_file, "application_server", "http_only", False):
 | 
				
			||||||
 | 
					            local_port = int(
 | 
				
			||||||
 | 
					                get_config(config_file, "application_server", "nginx_listen_port", "80")
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
        parser.add_argument(
 | 
					        parser.add_argument(
 | 
				
			||||||
            "hooks_http",
 | 
					            "hooks_http",
 | 
				
			||||||
            help="[An HTTP endpoint to which hook events will be sent to]",
 | 
					            help="[An HTTP endpoint to which hook events will be sent to]",
 | 
				
			||||||
            default="http://127.0.0.1/api/internal/tusd",
 | 
					            default=f"http://127.0.0.1:{local_port}/api/internal/tusd",
 | 
				
			||||||
            nargs="?",
 | 
					            nargs="?",
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user