mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Create the mail method from db:seed
As opposed the to sample users and enterprises that ease testing and development, the mail method is needed for the app to function in any environment.
This commit is contained in:
21
db/seeds.rb
21
db/seeds.rb
@@ -29,3 +29,24 @@ states.each do |state|
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
create_mail_method
|
||||
|
||||
def create_mail_method
|
||||
Spree::MailMethod.destroy_all
|
||||
|
||||
CreateMailMethod.new(
|
||||
environment: Rails.env,
|
||||
preferred_enable_mail_delivery: true,
|
||||
preferred_mail_host: ENV['MAIL_HOST'],
|
||||
preferred_mail_domain: ENV['MAIL_DOMAIN'],
|
||||
preferred_mail_port: ENV['MAIL_PORT'],
|
||||
preferred_mail_auth_type: 'login',
|
||||
preferred_smtp_username: ENV['SMTP_USERNAME'],
|
||||
preferred_smtp_password: ENV['SMTP_PASSWORD'],
|
||||
preferred_secure_connection_type: 'None',
|
||||
preferred_mails_from: "no-reply@#{ENV['MAIL_DOMAIN']}",
|
||||
preferred_mail_bcc: '',
|
||||
preferred_intercept_email: ''
|
||||
).call
|
||||
end
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace :openfoodnetwork do
|
||||
country = Spree::Country.find_by_iso(ENV.fetch('DEFAULT_COUNTRY_CODE'))
|
||||
state = country.states.first
|
||||
|
||||
create_mail_method
|
||||
|
||||
# -- Shipping / payment information
|
||||
unless Spree::Zone.find_by_name 'Australia'
|
||||
puts "[#{task_name}] Seeding shipping / payment information"
|
||||
@@ -207,24 +205,5 @@ namespace :openfoodnetwork do
|
||||
|
||||
spree_user.confirm!
|
||||
end
|
||||
|
||||
def create_mail_method
|
||||
Spree::MailMethod.destroy_all
|
||||
|
||||
CreateMailMethod.new(
|
||||
environment: Rails.env,
|
||||
preferred_enable_mail_delivery: true,
|
||||
preferred_mail_host: ENV['MAIL_HOST'],
|
||||
preferred_mail_domain: ENV['MAIL_DOMAIN'],
|
||||
preferred_mail_port: ENV['MAIL_PORT'],
|
||||
preferred_mail_auth_type: "login",
|
||||
preferred_smtp_username: ENV['SMTP_USERNAME'],
|
||||
preferred_smtp_password: ENV['SMTP_PASSWORD'],
|
||||
preferred_secure_connection_type: "None",
|
||||
preferred_mails_from: "no-reply@#{ENV['MAIL_DOMAIN']}",
|
||||
preferred_mail_bcc: "",
|
||||
preferred_intercept_email: ""
|
||||
).call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user