Skip to content

Commit

Permalink
now accessing api key via env variable instead of credentials file
Browse files Browse the repository at this point in the history
  • Loading branch information
clydeautin committed Sep 16, 2024
1 parent f37e9e7 commit 91c204a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ jobs:
POSTGRES_USER: rails
POSTGRES_PASSWORD: password

env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
TICKETMASTER_API_KEY: ${{ secrets.TICKETMASTER_API_KEY }}
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}

steps:
- name: Checkout code
Expand All @@ -103,11 +103,11 @@ jobs:
- name: Set up database
run: bin/rails db:create db:schema:load

- name: Set up Rails credentials
run: |
mkdir -p ~/.rails
echo "${{ secrets.RAILS_CREDENTIALS_CONTENT }}" > ~/.rails/credentials.yml.enc
echo "${{ secrets.RAILS_MASTER_KEY }}" > ~/.rails/master.key
# - name: Set up Rails credentials
# run: |
# mkdir -p ~/.rails
# echo "${{ secrets.RAILS_CREDENTIALS_CONTENT }}" > ~/.rails/credentials.yml.enc
# echo "${{ secrets.RAILS_MASTER_KEY }}" > ~/.rails/master.key

- name: Run tests
run: bundle exec rspec
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ group :development, :test do
gem "factory_bot_rails"
gem 'bundler-audit'
gem 'brakeman'
gem 'dotenv-rails'
gem "rspec"
gem "shoulda-matchers", "~> 5.0"
gem 'rswag'
Expand Down
4 changes: 2 additions & 2 deletions spec/services/ticket_master_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
base_url = "https://app.ticketmaster.com/discovery/v2/events.json"

json_response_drake = File.read("spec/fixtures/drake_events.json")
api_key = Rails.application.credentials.ticket_master[:api_key]
# api_key = ENV['TICKETMASTER_API_KEY']
# api_key = Rails.application.credentials.ticket_master[:api_key]
api_key = ENV['TICKETMASTER_API_KEY']
artist = "Drake"

stub_request(:get, "#{base_url}?keyword=#{artist}&apikey=#{api_key}")
Expand Down

0 comments on commit 91c204a

Please sign in to comment.