Skip to content

Commit d299986

Browse files
authored
Merge pull request #1653 from alphagov/update-api-configuration
Update configuration for API requests
2 parents c49ca2b + ae1dcc4 commit d299986

26 files changed

+31
-172
lines changed

.review_apps/ecs_task_definition.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ locals {
2222
{ name = "SETTINGS__ANALYTICS_ENABLED", value = "false" },
2323
{ name = "SETTINGS__CLOUDWATCH_METRICS_ENABLED", value = "false" },
2424
{ name = "SETTINGS__FORMS_ADMIN__BASE_URL", value = "https://${local.admin_app_hostname}" },
25-
{ name = "SETTINGS__FORMS_API__AUTH_KEY", value = "unsecured_api_key_for_review_apps_only" },
2625
{ name = "SETTINGS__FORMS_API__BASE_URL", value = "http://localhost:9292" },
2726
{ name = "SETTINGS__FORMS_ENV", value = "review" },
2827

@@ -40,7 +39,6 @@ locals {
4039
{ name = "RAILS_DEVELOPMENT_HOSTS", value = "localhost:9292" },
4140
{ name = "RAILS_ENV", value = "production" },
4241
{ name = "SECRET_KEY_BASE", value = "unsecured_secret_key_material" },
43-
{ name = "SETTINGS__FORMS_API__AUTH_KEY", value = "unsecured_api_key_for_review_apps_only" },
4442
{ name = "SETTINGS__FORMS_ENV", value = "review" },
4543
]
4644

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ gem "tzinfo-data"
3838
# Reduces boot times through caching; required in config/boot.rb
3939
gem "bootsnap", require: false
4040

41-
# For forms-api
41+
# For requests to the forms-admin API
4242
gem "activeresource"
4343

4444
# Use postgresql as the database for Active Record

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ or run the rails server:
4747
npm run dev
4848
```
4949

50-
You will also need to run the [forms-api service](https://github.com/alphagov/forms-api), as this app needs the API to create and access forms.
50+
You will also need to run the [forms-admin service](https://github.com/alphagov/forms-admin), as this app needs the API to create and access forms.
5151

5252
#### Getting AWS credentials
5353

app/resources/api/v2/form_document_resource.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ class Api::V2::FormDocumentResource < ActiveResource::Base
33
self.site = Settings.forms_api.base_url
44
self.prefix = "/api/v2/"
55
self.include_format_in_path = false
6-
headers["X-API-Token"] = Settings.forms_api.auth_key
76

87
class Step < ActiveResource::Base
98
self.site = Settings.forms_api.base_url

config/settings.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ forms_admin:
66
base_url: http://localhost:3000
77

88
forms_api:
9-
# Authentication key to authenticate forms-runner to forms-api
10-
auth_key: development_key
11-
# URL to form-api endpoints
12-
base_url: http://localhost:9292
9+
# URL to form-admin API endpoints
10+
base_url: http://localhost:3000
1311

1412
# Settings for GOV.UK Notify api & email templates
1513
govuk_notify:

spec/config/settings_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
describe ".forms_api" do
3030
forms_api = settings[:forms_api]
3131

32-
include_examples expected_value_test, :auth_key, forms_api, "development_key"
33-
include_examples expected_value_test, :base_url, forms_api, "http://localhost:9292"
32+
include_examples expected_value_test, :base_url, forms_api, "http://localhost:3000"
3433
end
3534

3635
describe ".govuk_notify" do

spec/features/email_confirmation_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,8 @@
66
let(:question_text) { Faker::Lorem.question }
77
let(:text_answer) { Faker::Lorem.sentence }
88

9-
let(:req_headers) do
10-
{
11-
"X-API-Token" => Settings.forms_api.auth_key,
12-
"Accept" => "application/json",
13-
}
14-
end
15-
let(:post_headers) do
16-
{
17-
"X-API-Token" => Settings.forms_api.auth_key,
18-
"Content-Type" => "application/json",
19-
}
20-
end
9+
let(:req_headers) { { "Accept" => "application/json" } }
10+
let(:post_headers) { { "Content-Type" => "application/json" } }
2111

2212
before do
2313
ActiveResource::HttpMock.respond_to do |mock|

spec/features/fill_in_and_submit_form_spec.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,8 @@
77
let(:answer_text) { "Answer text" }
88
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
99

10-
let(:req_headers) do
11-
{
12-
"X-API-Token" => Settings.forms_api.auth_key,
13-
"Accept" => "application/json",
14-
}
15-
end
16-
17-
let(:post_headers) do
18-
{
19-
"X-API-Token" => Settings.forms_api.auth_key,
20-
"Content-Type" => "application/json",
21-
}
22-
end
10+
let(:req_headers) { { "Accept" => "application/json" } }
11+
let(:post_headers) { { "Content-Type" => "application/json" } }
2312

2413
before do
2514
ActiveResource::HttpMock.respond_to do |mock|

spec/features/fill_in_and_submit_form_with_csv_spec.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
end
1010
let(:form) { build :v2_form_document, :live?, id: 1, name: "Fill in this form", steps:, start_page: steps.first.id, submission_type: "email_with_csv" }
1111
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
12-
let(:req_headers) do
13-
{
14-
"X-API-Token" => Settings.forms_api.auth_key,
15-
"Accept" => "application/json",
16-
}
17-
end
12+
let(:req_headers) { { "Accept" => "application/json" } }
1813

1914
before do
2015
ActiveResource::HttpMock.respond_to do |mock|

spec/features/fill_in_autocomplete_question_spec.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,8 @@
88
let(:answer_text) { "Answer 1" }
99
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
1010

11-
let(:req_headers) do
12-
{
13-
"X-API-Token" => Settings.forms_api.auth_key,
14-
"Accept" => "application/json",
15-
}
16-
end
17-
18-
let(:post_headers) do
19-
{
20-
"X-API-Token" => Settings.forms_api.auth_key,
21-
"Content-Type" => "application/json",
22-
}
23-
end
11+
let(:req_headers) { { "Accept" => "application/json" } }
12+
let(:post_headers) { { "Content-Type" => "application/json" } }
2413

2514
before do
2615
ActiveResource::HttpMock.respond_to do |mock|

0 commit comments

Comments
 (0)