Skip to content
This repository was archived by the owner on Dec 30, 2020. It is now read-only.

Commit 0b23659

Browse files
committed
Switch from v2_endpoint to directory
1 parent 8e60187 commit 0b23659

File tree

9 files changed

+23
-23
lines changed

9 files changed

+23
-23
lines changed

docs/upgrading.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Switching to ACMEv2 broke backwards compatibility in a couple ways.
44

5-
- You need to change the `endpoint` entry in your config to `v2_endpoint` and update it to staging or production.
6-
v2_endpoint = "https://acme-staging-v02.api.letsencrypt.org/directory" # Staging
7-
#v2_endpoint = "https://acme-v02.api.letsencrypt.org/directory" # Production
5+
- You need to change the `endpoint` entry in your config to `directory` and update it to staging or production.
6+
directory = "https://acme-staging-v02.api.letsencrypt.org/directory" # Staging
7+
#directory = "https://acme-v02.api.letsencrypt.org/directory" # Production
88

99
# Upgrading from v2 to v3
1010

lib/letsencrypt_webfaction/application/run.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def private_key
157157
end
158158

159159
def client
160-
@_client ||= Acme::Client.new(private_key: private_key, endpoint: @options.endpoint)
160+
@_client ||= Acme::Client.new(private_key: private_key, directory: @options.directory)
161161
end
162162

163163
def register_key

lib/letsencrypt_webfaction/options.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
module LetsencryptWebfaction
77
class Options
8-
NON_BLANK_FIELDS = %i[username password letsencrypt_account_email v2_endpoint api_url servername].freeze
8+
NON_BLANK_FIELDS = %i[username password letsencrypt_account_email directory api_url servername].freeze
99

1010
WEBFACTION_API_URL = 'https://api.webfaction.com/'.freeze
1111

@@ -39,8 +39,8 @@ def letsencrypt_account_email
3939
@config['letsencrypt_account_email']
4040
end
4141

42-
def v2_endpoint
43-
@config['v2_endpoint']
42+
def directory
43+
@config['directory']
4444
end
4545

4646
def api_url
@@ -57,7 +57,7 @@ def certificates
5757

5858
def errors
5959
{}.tap do |e|
60-
e[:endpoint] = 'needs to be updated to v2_endpoint. See upgrade documentation.' if @config.key?('endpoint')
60+
e[:endpoint] = 'needs to be updated to directory. See upgrade documentation.' if @config.key?('endpoint')
6161
NON_BLANK_FIELDS.each do |field|
6262
e[field] = "can't be blank" if public_send(field).nil? || public_send(field) == ''
6363
end

spec/fixtures/test.config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
key_size: 2048
2-
endpoint: 'https://acme.example.com/'
2+
directory: 'https://acme.example.com/'
33
domains:
44
- 'example.com'
55
- 'www.example.com'

spec/fixtures/test_invalid_config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ letsencrypt_account_email = "[email protected]"
77

88
# The ACME endpoint. Use the staging server until you get everything working.
99
# Then switch to the production endpoint.
10-
endpoint = "https://acme-staging.api.letsencrypt.org/" # Staging
11-
#endpoint = "https://acme-v01.api.letsencrypt.org/" # Production
10+
directory = "https://acme-staging.api.letsencrypt.org/" # Staging
11+
#directory = "https://acme-v01.api.letsencrypt.org/" # Production
1212

1313
# The URL to the WebFaction API. You should not change this under normal
1414
# circumstances.

spec/fixtures/test_public.config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
key_size: 2048
2-
endpoint: 'https://acme.example.com/'
2+
directory: 'https://acme.example.com/'
33
domains:
44
- 'example.com'
55
- 'www.example.com'

spec/fixtures/test_valid_config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
username = "myusername"
22
password = "mypassword"
33
letsencrypt_account_email = "[email protected]"
4-
endpoint = "https://acme-staging.api.letsencrypt.org/" # Staging
4+
directory = "https://acme-staging.api.letsencrypt.org/" # Staging
55
api_url = "https://wfserverapi.example.com/"
66
servername = "myservername"
77

spec/lib/letsencrypt_webfaction/options_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
let(:username) { 'myusername' }
55
let(:password) { 'mypassword' }
66
let(:letsencrypt_account_email) { '[email protected]' }
7-
let(:v2_endpoint) { 'https://acme.example.com/' }
7+
let(:directory) { 'https://acme.example.com/' }
88
let(:additional_config) { '' }
99
let(:cert_name) { 'mycertname1' }
1010
let(:toml) do
1111
<<-TOML
1212
username = "#{username}"
1313
password = "#{password}"
1414
letsencrypt_account_email = "#{letsencrypt_account_email}"
15-
v2_endpoint = "#{v2_endpoint}"
15+
directory = "#{directory}"
1616
#{additional_config}
1717
[[certificate]]
1818
domains = [
@@ -41,8 +41,8 @@
4141
end
4242
end
4343

44-
describe '#v2_endpoint' do
45-
subject { options.v2_endpoint }
44+
describe '#directory' do
45+
subject { options.directory }
4646
it { is_expected.to eq 'https://acme.example.com/' }
4747
end
4848

@@ -106,13 +106,13 @@
106106
context 'with ACMEv1 endpoint' do
107107
let(:additional_config) { 'endpoint = "blah"' }
108108

109-
it { is_expected.to eq(endpoint: 'needs to be updated to v2_endpoint. See upgrade documentation.') }
109+
it { is_expected.to eq(endpoint: 'needs to be updated to directory. See upgrade documentation.') }
110110
end
111111

112-
context 'with invalid v2_endpoint' do
113-
let(:v2_endpoint) { '' }
112+
context 'with invalid directory' do
113+
let(:directory) { '' }
114114

115-
it { is_expected.to eq(v2_endpoint: "can't be blank") }
115+
it { is_expected.to eq(directory: "can't be blank") }
116116
end
117117

118118
context 'with invalid api_url' do

templates/letsencrypt_webfaction.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ letsencrypt_account_email = "[email protected]"
88
# The ACME endpoint. Use the staging server until you get everything working.
99
# Then switch to the production endpoint. You may want to run with the --force
1010
# command after switching to reissue all certificates.
11-
v2_endpoint = "https://acme-staging-v02.api.letsencrypt.org/directory" # Staging
12-
#v2_endpoint = "https://acme-v02.api.letsencrypt.org/directory" # Production
11+
directory = "https://acme-staging-v02.api.letsencrypt.org/directory" # Staging
12+
#directory = "https://acme-v02.api.letsencrypt.org/directory" # Production
1313

1414
# The URL to the WebFaction API. You should not change this under normal
1515
# circumstances.

0 commit comments

Comments
 (0)