mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	tusd: Attempt to derive S3 region.
We already do this in computed_settings.py, but only if the S3 (secret) key is set. Those aren't required to be set, and tusd _requires_ a region, so we try again to suss it out here.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							794588629d
						
					
				
				
					commit
					9c043c6c14
				
			@@ -63,6 +63,10 @@ class Command(BaseCommand):
 | 
				
			|||||||
                env_vars["AWS_ACCESS_KEY_ID"] = settings.S3_KEY
 | 
					                env_vars["AWS_ACCESS_KEY_ID"] = settings.S3_KEY
 | 
				
			||||||
            if settings.S3_SECRET_KEY is not None:
 | 
					            if settings.S3_SECRET_KEY is not None:
 | 
				
			||||||
                env_vars["AWS_SECRET_ACCESS_KEY"] = settings.S3_SECRET_KEY
 | 
					                env_vars["AWS_SECRET_ACCESS_KEY"] = settings.S3_SECRET_KEY
 | 
				
			||||||
            assert settings.S3_REGION is not None
 | 
					            if settings.S3_REGION is None:
 | 
				
			||||||
            env_vars["AWS_REGION"] = settings.S3_REGION
 | 
					                import boto3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                env_vars["AWS_REGION"] = boto3.client("s3").meta.region_name
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                env_vars["AWS_REGION"] = settings.S3_REGION
 | 
				
			||||||
        os.execvpe("tusd", tusd_args, env_vars)
 | 
					        os.execvpe("tusd", tusd_args, env_vars)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user