Class: ObjectStorage::Config
- Inherits:
-
Object
- Object
- ObjectStorage::Config
- Defined in:
- lib/object_storage/config.rb
Constant Summary collapse
- AWS_PROVIDER =
'AWS'
- AZURE_PROVIDER =
'AzureRM'
- GOOGLE_PROVIDER =
'Google'
- LOCATIONS =
{ artifacts: Gitlab.config.artifacts, ci_secure_files: Gitlab.config.ci_secure_files, dependency_proxy: Gitlab.config.dependency_proxy, external_diffs: Gitlab.config.external_diffs, lfs: Gitlab.config.lfs, packages: Gitlab.config.packages, pages: Gitlab.config.pages, terraform_state: Gitlab.config.terraform_state, uploads: Gitlab.config.uploads }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#aws? ⇒ Boolean
AWS-specific options.
- #aws_server_side_encryption_enabled? ⇒ Boolean
- #azure? ⇒ Boolean
-
#azure_storage_domain ⇒ Object
Begin Azure-specific options.
- #bucket ⇒ Object
- #consolidated_settings? ⇒ Boolean
- #credentials ⇒ Object
- #enabled? ⇒ Boolean
- #fog_attributes ⇒ Object
-
#google? ⇒ Boolean
End Azure-specific options.
-
#initialize(options) ⇒ Config
constructor
A new instance of Config.
- #provider ⇒ Object
- #server_side_encryption ⇒ Object
- #server_side_encryption_kms_key_id ⇒ Object
- #storage_options ⇒ Object
- #use_iam_profile? ⇒ Boolean
- #use_path_style? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Config
Returns a new instance of Config.
23 24 25 |
# File 'lib/object_storage/config.rb', line 23 def initialize() @options = .to_hash.deep_symbolize_keys end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/object_storage/config.rb', line 21 def @options end |
Instance Method Details
#aws? ⇒ Boolean
AWS-specific options
48 49 50 |
# File 'lib/object_storage/config.rb', line 48 def aws? provider == AWS_PROVIDER end |
#aws_server_side_encryption_enabled? ⇒ Boolean
95 96 97 |
# File 'lib/object_storage/config.rb', line 95 def aws_server_side_encryption_enabled? aws? && server_side_encryption.present? end |
#azure? ⇒ Boolean
83 84 85 |
# File 'lib/object_storage/config.rb', line 83 def azure? provider == AZURE_PROVIDER end |
#azure_storage_domain ⇒ Object
Begin Azure-specific options
74 75 76 |
# File 'lib/object_storage/config.rb', line 74 def azure_storage_domain credentials[:azure_storage_domain] end |
#bucket ⇒ Object
39 40 41 |
# File 'lib/object_storage/config.rb', line 39 def bucket [:remote_directory] end |
#consolidated_settings? ⇒ Boolean
43 44 45 |
# File 'lib/object_storage/config.rb', line 43 def consolidated_settings? .fetch(:consolidated_settings, false) end |
#credentials ⇒ Object
27 28 29 |
# File 'lib/object_storage/config.rb', line 27 def credentials @credentials ||= connection_params end |
#enabled? ⇒ Boolean
35 36 37 |
# File 'lib/object_storage/config.rb', line 35 def enabled? [:enabled] end |
#fog_attributes ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/object_storage/config.rb', line 87 def fog_attributes @fog_attributes ||= begin return {} unless aws_server_side_encryption_enabled? aws_server_side_encryption_headers.compact end end |
#google? ⇒ Boolean
End Azure-specific options
79 80 81 |
# File 'lib/object_storage/config.rb', line 79 def google? provider == GOOGLE_PROVIDER end |
#provider ⇒ Object
68 69 70 |
# File 'lib/object_storage/config.rb', line 68 def provider credentials[:provider].to_s end |
#server_side_encryption ⇒ Object
60 61 62 |
# File 'lib/object_storage/config.rb', line 60 def server_side_encryption [:server_side_encryption] end |
#server_side_encryption_kms_key_id ⇒ Object
64 65 66 |
# File 'lib/object_storage/config.rb', line 64 def server_side_encryption_kms_key_id [:server_side_encryption_kms_key_id] end |
#storage_options ⇒ Object
31 32 33 |
# File 'lib/object_storage/config.rb', line 31 def @storage_options ||= [:storage_options] || {} end |