Add --upload_timeout bootstrap option (#2363)

This commit is contained in:
Skull Writter
2019-08-25 17:43:47 +00:00
committed by Naoki Takezoe
parent 6b252a7018
commit b372c71fbf
5 changed files with 14 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ You can specify following options:
- `--gitbucket.home=[DATA_DIR]` - `--gitbucket.home=[DATA_DIR]`
- `--temp_dir=[TEMP_DIR]` - `--temp_dir=[TEMP_DIR]`
- `--max_file_size=[MAX_FILE_SIZE]` - `--max_file_size=[MAX_FILE_SIZE]`
- `--upload_timeout=[MAX_UPLOAD_TIMEOUT]`
`TEMP_DIR` is used as the [temporary directory for the jetty application context](https://www.eclipse.org/jetty/documentation/9.3.x/ref-temporary-directories.html). This is the directory into which the `gitbucket.war` file is unpacked, the source files are compiled, etc. If given this parameter **must** match the path of an existing directory or the application will quit reporting an error; if not given the path used will be a `tmp` directory inside the gitbucket home. `TEMP_DIR` is used as the [temporary directory for the jetty application context](https://www.eclipse.org/jetty/documentation/9.3.x/ref-temporary-directories.html). This is the directory into which the `gitbucket.war` file is unpacked, the source files are compiled, etc. If given this parameter **must** match the path of an existing directory or the application will quit reporting an error; if not given the path used will be a `tmp` directory inside the gitbucket home.

View File

@@ -42,6 +42,9 @@ public class JettyLauncher {
case "--max_file_size": case "--max_file_size":
System.setProperty("gitbucket.maxFileSize", dim[1]); System.setProperty("gitbucket.maxFileSize", dim[1]);
break; break;
case "--upload_timeout":
System.setProperty("gitbucket.UploadTimeout", dim[1]);
break;
case "--gitbucket.home": case "--gitbucket.home":
System.setProperty("gitbucket.home", dim[1]); System.setProperty("gitbucket.home", dim[1]);
break; break;

View File

@@ -96,4 +96,10 @@ object FileUtil {
else else
3 * 1024 * 1024 3 * 1024 * 1024
lazy val UploadTimeout =
if (System.getProperty("gitbucket.UploadTimeout") != null)
System.getProperty("gitbucket.UploadTimeout").toLong
else
3 * 10000
} }

View File

@@ -66,6 +66,8 @@ $(function(){
@dropzone(clickable: Boolean, textareaId: Option[String]) = { @dropzone(clickable: Boolean, textareaId: Option[String]) = {
url: '@context.path/upload/file/@repository.owner/@repository.name', url: '@context.path/upload/file/@repository.owner/@repository.name',
maxFilesize: @{FileUtil.MaxFileSize / 1024 / 1024}, maxFilesize: @{FileUtil.MaxFileSize / 1024 / 1024},
//timeout defaults to 30 secs
timeout: @{FileUtil.UploadTimeout},
clickable: @clickable, clickable: @clickable,
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>", previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
success: function(file, id) { success: function(file, id) {

View File

@@ -73,6 +73,8 @@ $(function(){
$("#drop").dropzone({ $("#drop").dropzone({
maxFilesize: @{gitbucket.core.util.FileUtil.MaxFileSize / 1024 / 1024}, maxFilesize: @{gitbucket.core.util.FileUtil.MaxFileSize / 1024 / 1024},
url: '@context.path/upload/release/@repository.owner/@repository.name/@helpers.encodeRefName(tag.name)', url: '@context.path/upload/release/@repository.owner/@repository.name/@helpers.encodeRefName(tag.name)',
//timeout defaults to 30 secs
timeout: @{gitbucket.core.util.FileUtil.UploadTimeout},
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>", previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your files...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
success: function(file, id) { success: function(file, id) {
var attach = var attach =