Skip to content

Commit

Permalink
seed api credential with token data in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xihai01 committed Feb 26, 2025
1 parent bf2d43d commit bb13f87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,4 @@ def create_org_related_data(db_populator, casa_org, options)
Rails.logger.error { "Caught error during db seed emancipation_options_prune, continuing. Message: #{e}" }
end
load(Rails.root.join("db/seeds/placement_data.rb"))
load(Rails.root.join("db/seeds/api_credential_data.rb"))
6 changes: 6 additions & 0 deletions db/seeds/api_credential_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ApiCredential.destroy_all
users = User.all

users.each do |user|
ApiCredential.create!(user: user, api_token_digest: Digest::SHA256.hexdigest(SecureRandom.hex(18)), refresh_token_digest: Digest::SHA256.hexdigest(SecureRandom.hex(18)))
end

0 comments on commit bb13f87

Please sign in to comment.