Sha256: 0f63023349e3fc3453b3e3f446ff81e6d5ca06cde261dae9b8651c6574537870

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

require 'sinatra-index'
require 'sinatra_auth_github'
require 'dotenv'
require 'safe_yaml'
require 'colorator'
require 'mkmf'
require_relative 'jekyll_auth/version'
require_relative 'jekyll_auth/helpers'
require_relative 'jekyll_auth/auth_site'
require_relative 'jekyll_auth/jekyll_site'
require_relative 'jekyll_auth/config_error'
require_relative 'jekyll_auth/commands'

Dotenv.load

class JekyllAuth
  def self.site
    Rack::Builder.new do
      use JekyllAuth::AuthSite
      run JekyllAuth::JekyllSite
    end
  end

  def self.config_file
    File.join(Dir.pwd, "_config.yml")
  end

  def self.config
    @config ||= begin
      config = YAML.safe_load_file(config_file)
      config["jekyll_auth"] || {}
    rescue
      {}
    end
  end

  def self.whitelist
    whitelist = JekyllAuth::config["whitelist"]
    Regexp.new(whitelist.join("|")) unless whitelist.nil?
  end

  def self.ssl?
    !!JekyllAuth::config["ssl"]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-auth-1.0.0 lib/jekyll-auth.rb