2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-07-11 21:29:13 -04:00
|
|
|
def storage_validation_error(message)
|
2016-06-22 17:04:51 -04:00
|
|
|
raise "#{message}. Please fix this in your gitlab.yml before starting GitLab."
|
|
|
|
end
|
|
|
|
|
2017-03-08 11:15:05 -05:00
|
|
|
def validate_storages_config
|
2019-06-28 04:28:28 -04:00
|
|
|
if Gitlab.config.repositories.storages.empty?
|
|
|
|
storage_validation_error('No repository storage path defined')
|
|
|
|
end
|
2017-05-17 12:17:15 -04:00
|
|
|
|
2019-06-28 04:28:28 -04:00
|
|
|
Gitlab.config.repositories.storages.keys.each do |name|
|
|
|
|
unless /\A[a-zA-Z0-9\-_]+\z/.match?(name)
|
|
|
|
storage_validation_error("\"#{name}\" is not a valid storage name")
|
2017-05-17 12:17:15 -04:00
|
|
|
end
|
2017-03-08 11:15:05 -05:00
|
|
|
end
|
|
|
|
end
|
2017-02-28 16:08:40 -05:00
|
|
|
|
2017-03-08 11:15:05 -05:00
|
|
|
validate_storages_config
|