Class: Jekyll::Gitlab::Letsencrypt::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/gitlab/letsencrypt/configuration.rb

Constant Summary collapse

DEFAULT_FILENAME =
'letsencrypt_challenge.html'
DEFAULT_ENDPOINT =
'https://acme-v01.api.letsencrypt.org/'
DEFAULT_BRANCH =
'master'
DEFAULT_LAYOUT =
'null'
DEFAULT_INITIAL_DELAY =
120
DEFAULT_DELAY_TIME =
15
DEFAULT_SCHEME =
'http'
REQUIRED_KEYS =
%w{gitlab_repo email domain}

Class Method Summary collapse

Class Method Details

.base_pathObject



32
33
34
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 32

def base_path
  jekyll_config['base_path'] || ''
end

.branchObject



56
57
58
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 56

def branch
  jekyll_config['branch'] || DEFAULT_BRANCH
end

.delay_timeObject



68
69
70
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 68

def delay_time
  jekyll_config['delay_time'] || DEFAULT_DELAY_TIME
end

.domainObject



52
53
54
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 52

def domain
  jekyll_config['domain']
end

.emailObject



48
49
50
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 48

def email
  jekyll_config['email']
end

.endpointObject



24
25
26
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 24

def endpoint
  jekyll_config['endpoint'] || DEFAULT_ENDPOINT
end

.filenameObject



60
61
62
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 60

def filename
  jekyll_config['filename'] || DEFAULT_FILENAME
end

.gitlab_repoObject



28
29
30
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 28

def gitlab_repo
  jekyll_config['gitlab_repo']
end

.initial_delayObject



64
65
66
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 64

def initial_delay
  jekyll_config['initial_delay'] || DEFAULT_INITIAL_DELAY
end

.jekyll_configObject



80
81
82
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 80

def jekyll_config
  @jekyll_config ||= (Jekyll.configuration({})['gitlab-letsencrypt'] || {})
end

.layoutObject



40
41
42
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 40

def layout
  jekyll_config['layout'] || DEFAULT_LAYOUT
end

.personal_access_tokenObject



44
45
46
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 44

def personal_access_token
  jekyll_config['personal_access_token'].presence || ENV['GITLAB_TOKEN'].presence
end

.pretty_url?Boolean



36
37
38
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 36

def pretty_url?
  !!jekyll_config['pretty_url']
end

.reset!Object



76
77
78
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 76

def reset!
  @jekyll_config = nil
end

.schemeObject



72
73
74
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 72

def scheme
  jekyll_config['scheme'] || DEFAULT_SCHEME
end

.valid?Boolean



20
21
22
# File 'lib/jekyll/gitlab/letsencrypt/configuration.rb', line 20

def valid?
  REQUIRED_KEYS.all? { |key| jekyll_config.has_key? key } && personal_access_token
end