lib/jekyll_auth/config.rb in jekyll-auth-2.1.0 vs lib/jekyll_auth/config.rb in jekyll-auth-2.1.1
- old
+ new
@@ -1,23 +1,30 @@
+# frozen_string_literal: true
+
class JekyllAuth
def self.config_file
File.join(Dir.pwd, "_config.yml")
end
+ def self.jekyll_config
+ @config ||= YAML.safe_load_file(config_file)
+ rescue StandardError
+ {}
+ end
+
def self.config
- @config ||= begin
- config = YAML.safe_load_file(config_file)
- config["jekyll_auth"] || {}
- rescue
- {}
- end
+ jekyll_config.fetch("jekyll_auth", {})
end
+ def self.destination
+ jekyll_config.fetch("destination", File.expand_path("_site", Dir.pwd))
+ end
+
def self.whitelist
- whitelist = JekyllAuth.config["whitelist"]
+ whitelist = config["whitelist"]
Regexp.new(whitelist.join("|")) unless whitelist.nil?
end
def self.ssl?
- !!JekyllAuth.config["ssl"]
+ !!config["ssl"]
end
end