mirror of
https://github.com/discourse/discourse.git
synced 2025-04-22 16:39:12 +08:00
FIX: Update api_key rake task for recent changes
New usage: ``` rake api_key:get_or_create_master["Onboarding Key"] ```
This commit is contained in:
parent
920f8c6d75
commit
63bd07492e
@ -1,8 +1,9 @@
|
||||
# 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
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user