Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit ca7c764

Browse files
Add ability to read environment vars for API keys first
Instead of reading from the hardcoded API keys first, provide users with the ability to use their own.
1 parent 45c3c7a commit ca7c764

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

movie_search/movie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def wrap(s, width = 78)
1111

1212
def movie
1313
# This is a live API key, don't absue it
14-
api_key = '946f500a'
14+
api_key = ENV['OMDBAPI_API_KEY'] || '946f500a'
1515

1616
puts
1717
print 'Movie => '

weather/weather.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def weather_search
88
# This key is functional, please don't abuse it
9-
api_key = "6510b92495fd472ca30155709172803&q"
9+
api_key = ENV['APIXU_API_KEY'] || "6510b92495fd472ca30155709172803&q"
1010

1111
# Uses IP to get current city
1212
begin

0 commit comments

Comments
 (0)