mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-22 05:18:51 +00:00
Safeguard production env from test script
This commit is contained in:
@@ -6,6 +6,7 @@ namespace :ofn do
|
||||
desc "Repeat placement job for a specific Order Cycle"
|
||||
task repeat_placement_job: :environment do
|
||||
puts "WARNING: this task will generate new, and potentially duplicate, customer orders"
|
||||
exit_in_production
|
||||
|
||||
order_cycle_id = request_order_cycle_id
|
||||
|
||||
@@ -27,6 +28,7 @@ namespace :ofn do
|
||||
desc "Force confirmation job for a specific Order Cycle"
|
||||
task force_confirmation_job: :environment do
|
||||
puts "WARNING: this task will process payments in customer orders"
|
||||
exit_in_production
|
||||
|
||||
order_cycle_id = request_order_cycle_id
|
||||
|
||||
@@ -39,6 +41,13 @@ namespace :ofn do
|
||||
SubscriptionConfirmJob.new.perform
|
||||
end
|
||||
|
||||
def exit_in_production
|
||||
return unless Rails.env.production?
|
||||
|
||||
puts "Oops, we are in production environment. Exiting."
|
||||
exit
|
||||
end
|
||||
|
||||
def set_order_cycle_times(order_cycle_id, open_at, close_at)
|
||||
OrderCycle.find_by(id: order_cycle_id).update(orders_open_at: open_at,
|
||||
orders_close_at: close_at)
|
||||
|
||||
Reference in New Issue
Block a user