Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-03-28 16:09:25 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-03-31 14:19:37 +0400
commit200eeea2587d36a90f8308425887e953c48eecbc (patch)
tree49ca45637a76e11ec46d5965ca0b24b1305112cb
parent0488e34ba723b9a55bd6e35aafc0cf089b0b49fd (diff)
Make the repository downloads path configurable
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/projects/repositories_controller.rb2
-rw-r--r--config/gitlab.yml.example4
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--lib/api/repositories.rb2
5 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 19219915789..e3ab6a5e924 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@ v 6.8.0
- Make user search case-insensitive (Christopher Arnold)
- Remove omniauth-ldap nickname bug workaround
- Drop all tables before restoring a Postgres backup
+ - Make the repository downloads path configurable
v 6.7.2
- Fix upgrader script
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb
index f686db70bd4..d1a6fecba20 100644
--- a/app/controllers/projects/repositories_controller.rb
+++ b/app/controllers/projects/repositories_controller.rb
@@ -14,7 +14,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
render_404 and return
end
- storage_path = Rails.root.join("tmp", "repositories")
+ storage_path = Gitlab.config.gitlab.repository_downloads_path
file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase)
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 9364181eaa4..cb4b8c73a42 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -76,6 +76,10 @@ production: &base
snippets: false
visibility_level: "private" # can be "private" | "internal" | "public"
+ ## Repository downloads directory
+ # When a user clicks e.g. 'Download zip' on a project, a temporary zip file is created in the following directory.
+ # repository_downloads_path: tmp/repositories
+
## External issues trackers
issues_tracker:
# redmine:
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index cf6c79bb50e..70ba26cea7a 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -97,6 +97,7 @@ Settings.gitlab.default_projects_features['wiki'] = true if Settings.g
Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil?
Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil?
Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(:verify_constant, Gitlab::VisibilityLevel, Settings.gitlab.default_projects_features['visibility_level'], Gitlab::VisibilityLevel::PRIVATE)
+Settings.gitlab['repository_downloads_path'] = File.absolute_path(Settings.gitlab['repository_downloads_path'] || 'tmp/repositories', Rails.root)
#
# Gravatar
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index ba53bf9baa4..53482c3b7f2 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -161,7 +161,7 @@ module API
repo = user_project.repository
ref = params[:sha]
format = params[:format]
- storage_path = Rails.root.join("tmp", "repositories")
+ storage_path = Gitlab.config.gitlab.repository_downloads_path
file_path = repo.archive_repo(ref, storage_path, format)
if file_path && File.exists?(file_path)