Commit 200eeea2587d36a90f8308425887e953c48eecbc
1 parent
0488e34b
Exists in
spb-stable
and in
3 other branches
Make the repository downloads path configurable
Showing
5 changed files
with
8 additions
and
2 deletions
Show diff stats
CHANGELOG
@@ -4,6 +4,7 @@ v 6.8.0 | @@ -4,6 +4,7 @@ v 6.8.0 | ||
4 | - Make user search case-insensitive (Christopher Arnold) | 4 | - Make user search case-insensitive (Christopher Arnold) |
5 | - Remove omniauth-ldap nickname bug workaround | 5 | - Remove omniauth-ldap nickname bug workaround |
6 | - Drop all tables before restoring a Postgres backup | 6 | - Drop all tables before restoring a Postgres backup |
7 | + - Make the repository downloads path configurable | ||
7 | 8 | ||
8 | v 6.7.2 | 9 | v 6.7.2 |
9 | - Fix upgrader script | 10 | - Fix upgrader script |
app/controllers/projects/repositories_controller.rb
@@ -14,7 +14,7 @@ class Projects::RepositoriesController < Projects::ApplicationController | @@ -14,7 +14,7 @@ class Projects::RepositoriesController < Projects::ApplicationController | ||
14 | render_404 and return | 14 | render_404 and return |
15 | end | 15 | end |
16 | 16 | ||
17 | - storage_path = Rails.root.join("tmp", "repositories") | 17 | + storage_path = Gitlab.config.gitlab.repository_downloads_path |
18 | 18 | ||
19 | file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase) | 19 | file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase) |
20 | 20 |
config/gitlab.yml.example
@@ -76,6 +76,10 @@ production: &base | @@ -76,6 +76,10 @@ production: &base | ||
76 | snippets: false | 76 | snippets: false |
77 | visibility_level: "private" # can be "private" | "internal" | "public" | 77 | visibility_level: "private" # can be "private" | "internal" | "public" |
78 | 78 | ||
79 | + ## Repository downloads directory | ||
80 | + # When a user clicks e.g. 'Download zip' on a project, a temporary zip file is created in the following directory. | ||
81 | + # repository_downloads_path: tmp/repositories | ||
82 | + | ||
79 | ## External issues trackers | 83 | ## External issues trackers |
80 | issues_tracker: | 84 | issues_tracker: |
81 | # redmine: | 85 | # redmine: |
config/initializers/1_settings.rb
@@ -97,6 +97,7 @@ Settings.gitlab.default_projects_features['wiki'] = true if Settings.g | @@ -97,6 +97,7 @@ Settings.gitlab.default_projects_features['wiki'] = true if Settings.g | ||
97 | Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil? | 97 | Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil? |
98 | Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil? | 98 | Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil? |
99 | Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(:verify_constant, Gitlab::VisibilityLevel, Settings.gitlab.default_projects_features['visibility_level'], Gitlab::VisibilityLevel::PRIVATE) | 99 | Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(:verify_constant, Gitlab::VisibilityLevel, Settings.gitlab.default_projects_features['visibility_level'], Gitlab::VisibilityLevel::PRIVATE) |
100 | +Settings.gitlab['repository_downloads_path'] = File.absolute_path(Settings.gitlab['repository_downloads_path'] || 'tmp/repositories', Rails.root) | ||
100 | 101 | ||
101 | # | 102 | # |
102 | # Gravatar | 103 | # Gravatar |
lib/api/repositories.rb
@@ -161,7 +161,7 @@ module API | @@ -161,7 +161,7 @@ module API | ||
161 | repo = user_project.repository | 161 | repo = user_project.repository |
162 | ref = params[:sha] | 162 | ref = params[:sha] |
163 | format = params[:format] | 163 | format = params[:format] |
164 | - storage_path = Rails.root.join("tmp", "repositories") | 164 | + storage_path = Gitlab.config.gitlab.repository_downloads_path |
165 | 165 | ||
166 | file_path = repo.archive_repo(ref, storage_path, format) | 166 | file_path = repo.archive_repo(ref, storage_path, format) |
167 | if file_path && File.exists?(file_path) | 167 | if file_path && File.exists?(file_path) |