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:
authorToon Claes <toon@gitlab.com>2019-05-29 10:43:27 +0300
committerToon Claes <toon@gitlab.com>2019-07-01 14:40:21 +0300
commitd9f4f7faff5e5cf8841e9c58b08256e6c602ab56 (patch)
tree07f70a10bbfb82f5accf3383c60830d64e39d975
parent9d5526073782744a8553fc6b689174a46c29e851 (diff)
Safe-guard non-existence or emptiness of gdk.yml
Allow gdk.yml to be non-existing or empty.
-rw-r--r--lib/gdk/config_settings.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gdk/config_settings.rb b/lib/gdk/config_settings.rb
index 7b13f771d26..6429dbb9507 100644
--- a/lib/gdk/config_settings.rb
+++ b/lib/gdk/config_settings.rb
@@ -21,7 +21,7 @@ module GDK
sub = Class.new(ConfigSettings)
blk.call(sub)
- sub.new(parent: self, yaml: yaml[name.to_s])
+ sub.new(parent: self, yaml: yaml.fetch(name.to_s, {}))
end
else
raise SettingUndefined, "Could not find the setting '#{name}'"
@@ -68,9 +68,9 @@ module GDK
private
def load_yaml!
- return {} unless defined?(self.class::FILE)
+ return {} unless defined?(self.class::FILE) && File.exist?(self.class::FILE)
- @yaml = YAML.load_file(self.class::FILE)
+ @yaml = YAML.load_file(self.class::FILE) || {}
end
def from_yaml(key, default: nil)