Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions db/fixtures/production/02_runtimes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

initial_runtime_token = ENV.fetch('INITIAL_RUNTIME_TOKEN', nil)
return if initial_runtime_token.blank?

return unless Runtime.count.zero?

runtime = Runtime.new(
name: 'Initial Runtime',
description: 'Provisioned with token from INITIAL_RUNTIME_TOKEN environment variable',
token: initial_runtime_token
)

# rubocop:disable Code0/ZeroTrack/Logs/RailsLogger -- we can't include a module here
if runtime.save
Rails.logger.info(message: 'Initial runtime created')
else
Rails.logger.warn(message: 'Failed to create initial runtime', errors: runtime.errors.full_messages)
end
# rubocop:enable Code0/ZeroTrack/Logs/RailsLogger