a7dae52e9d
Move uploads to object storage Closes #4163 See merge request gitlab-org/gitlab-ee!3867
26 lines
536 B
Ruby
26 lines
536 B
Ruby
class NamespaceFileUploader < FileUploader
|
|
# Re-Override
|
|
def self.root
|
|
options.storage_path
|
|
end
|
|
|
|
def self.base_dir(model)
|
|
File.join(options.base_dir, 'namespace', model_path_segment(model))
|
|
end
|
|
|
|
def self.model_path_segment(model)
|
|
File.join(model.id.to_s)
|
|
end
|
|
|
|
# Re-Override
|
|
def store_dir
|
|
store_dirs[object_store]
|
|
end
|
|
|
|
def store_dirs
|
|
{
|
|
Store::LOCAL => File.join(base_dir, dynamic_segment),
|
|
Store::REMOTE => File.join('namespace', model_path_segment, dynamic_segment)
|
|
}
|
|
end
|
|
end
|