Skip to content

Commit c59097a

Browse files
authored
Merge pull request #1459 from PRX/rename-aud-env-var
Rename AUD env var
2 parents 0f9b666 + 8de30fa commit c59097a

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

app/models/apple/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def self.api_base
3434
end
3535

3636
def self.api_aud_name
37-
ENV["APPLE_PODCASTS_CONNECT_AUD_NAME"]
37+
ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"]
3838
end
3939

4040
def self.from_key(apple_key)

test/models/apple/api_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@
2525
payload = decoded.first
2626

2727
assert_equal payload["iss"], provider_id
28+
assert_equal payload["aud"], "aardvark"
2829
assert Time.at(payload["exp"]).utc.to_datetime > Time.now.utc + 14.minutes
2930

3031
algo = decoded.second
3132

3233
assert_equal algo, "typ" => "JWT", "alg" => "ES256", "kid" => key_id
3334
end
3435

36+
it "includes the aud from the environment variable" do
37+
assert_equal "aardvark", Apple::Api.api_aud_name
38+
assert_equal ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"], Apple::Api.api_aud_name
39+
end
40+
3541
describe "#local_api_retry_errors" do
3642
it "local api attempts exhausts retries until failure" do
3743
attempts = 0

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ENV["ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"] = "maybeyouarefeelingsaltyaboutthis"
2525
ENV["PODPING_AUTH_TOKEN"] = "test_token"
2626
ENV["APPLE_PODCASTS_CONNECT_API_URL"] = "https://aardvark.prx.org/"
27+
ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"] = "aardvark"
2728

2829
ENV["RAILS_ENV"] ||= "test"
2930
require_relative "../config/environment"

0 commit comments

Comments
 (0)