File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 1
- use Mix. Config
1
+ import Config
2
2
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 , "test_api_key"
4
+ config :thin_notion_api , :notion_version , "2021-08-16"
5
5
6
- config :exvcr , [
6
+ config :exvcr ,
7
7
vcr_cassette_library_dir: "fixture/vcr_cassettes" ,
8
8
custom_cassette_library_dir: "fixture/custom_cassettes" ,
9
9
filter_sensitive_data: [
@@ -12,4 +12,3 @@ config :exvcr, [
12
12
filter_url_params: false ,
13
13
filter_request_headers: [ "Authorization" ] ,
14
14
response_headers_blacklist: [ ]
15
- ]
Original file line number Diff line number Diff line change @@ -3,18 +3,14 @@ defmodule ThinNotionApi.Utils do
3
3
4
4
def api_key , do: Application . get_env ( :thin_notion_api , :api_key )
5
5
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 )
8
7
9
8
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 ( )
15
10
16
11
[ { "Authorization" , "Bearer " <> key } ]
17
12
end
13
+
18
14
def version_header , do: [ { "Notion-Version" , notion_version ( ) } ]
19
15
def content_header , do: [ { "Content-Type" , "application/json" } ]
20
16
def request_headers , do: version_header ( ) ++ auth_header ( )
You can’t perform that action at this time.
0 commit comments