Commit 63bd0749 authored by Jay Pfaffman's avatar Jay Pfaffman Committed by David Taylor

FIX: Update api_key rake task for recent changes

New usage: 

rake api_key:get_or_create_master["Onboarding Key"]
parent 920f8c6d
# frozen_string_literal: true
desc "generate api key if missing, return existing if already there"
task "api_key:get" => :environment do
api_key = ApiKey.create_master_key
desc "find or generate a master api key with given description"
task "api_key:get_or_create_master", [:description] => :environment do |task, args|
raise "Supply a description for the key" if !args[:description]
api_key = ApiKey.find_or_create_by!(description: args[:description], revoked_at: nil, user_id: nil)
puts api_key.key
puts api_key.key
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment