Skip to content

Commit d68d509

Browse files
author
Erik Guzman
authored
Merge pull request #2 from thomasfortes/migrate_from_mix_config
Migrate from mix config
2 parents 0298dd9 + 5d005f4 commit d68d509

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

config/config.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Config
22

3-
config :thin_notion_api, :api_key, System.get_env("NOTION_API_KEY")
4-
config :thin_notion_api, :notion_version, System.get_env("NOTION_VERSION")
3+
config :thin_notion_api, :api_key, System.get_env("NOTION_API_KEY", "test_api_key")
4+
config :thin_notion_api, :notion_version, System.get_env("NOTION_VERSION", "2021-08-16")
55

6-
config :exvcr, [
6+
config :exvcr,
77
vcr_cassette_library_dir: "fixture/vcr_cassettes",
88
custom_cassette_library_dir: "fixture/custom_cassettes",
99
filter_sensitive_data: [
@@ -12,4 +12,3 @@ config :exvcr, [
1212
filter_url_params: false,
1313
filter_request_headers: ["Authorization"],
1414
response_headers_blacklist: []
15-
]

lib/thin_notion_api/utils.ex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ defmodule ThinNotionApi.Utils do
33

44
def api_key, do: Application.get_env(:thin_notion_api, :api_key)
55

6-
def notion_version,
7-
do: Application.get_env(:thin_notion_api, :notion_version, "2021-08-16")
6+
def notion_version, do: Application.get_env(:thin_notion_api, :notion_version)
87

98
def auth_header do
10-
key = if Mix.env() == :test do
11-
api_key() || "test_api_key"
12-
else
13-
api_key()
14-
end
9+
key = api_key()
1510

1611
[{"Authorization", "Bearer " <> key}]
1712
end
13+
1814
def version_header, do: [{"Notion-Version", notion_version()}]
1915
def content_header, do: [{"Content-Type", "application/json"}]
2016
def request_headers, do: version_header() ++ auth_header()

0 commit comments

Comments
 (0)