Method: MailEngine::Configuration.config_check

Defined in:
lib/mail_engine/configuration.rb

.config_checkObject

Need check below config options

log_mail: true user_class_name: ‘User’ user_locale_column: ‘locale’ mount_at: ‘/admin/mail_engine’ intercept_email: ‘your email’ default_from: ‘you email’ access_check_method: ‘logged_in?’ sendgrid:

sendgrid_user: 'you send grid user'
sendgrid_key: 'you send grid password'
sendgrid_category: 'your send grid category'


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mail_engine/configuration.rb', line 29

def config_check
  if MailEngine::Base.current_config.blank?
    puts "\e[1;31;40m[Mail Engine Warning]\e[0m Not found mail_engine_config.yml, so mail_engine won't be able to work."
    raise ConfigurationError.new("did't find config file at config/mail_engine_config.yml")
  end

  ### if not set them will has some bad news
  # user_locale_column
  # access_check_method

  %w{log_mail user_class_name mount_at default_from}.each do |option|
    raise ConfigurationError.new("Please add :#{option} config into mail_engine_config.yml.") if MailEngine::Base.current_config[option].blank?
  end

  %w{sendgrid_category sendgrid_user sendgrid_key}.each do |option|
    raise ConfigurationError.new("Please add :#{option} config under not :sendgrid into mail_engine_config.yml.") if MailEngine::Base.current_config["sendgrid"][option].blank?
  end
rescue ConfigurationError => e
  puts "\\e[1;31;40m[Mail Engine Warning - Below is a sample config]\\e[0m\n===============================================\n  log_mail: true\n  user_class_name: 'User'\n  user_locale_column: 'locale'\n  mount_at: '/admin/mail_engine'\n  intercept_email: 'your email'\n  default_from: 'you email'\n  access_check_method: 'logged_in?'\n  sendgrid:\n    sendgrid_user: 'you send grid user'\n    sendgrid_key: 'you send grid password'\n    sendgrid_category: 'your send grid category'\n===============================================\n  NOTE\nend\n"