Module: Workarea::Warnings

Extended by:
Warnings
Included in:
Warnings
Defined in:
lib/workarea/warnings.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



5
6
7
8
9
10
# File 'lib/workarea/warnings.rb', line 5

def check
  check_timezone
  check_mongo_notable_scan
  check_dragonfly_config
  check_auto_capture
end

#check_auto_captureObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/workarea/warnings.rb', line 66

def check_auto_capture
  if Workarea.config.auto_capture
    warn <<~eos
**************************************************
⛔️ WARNING: Workarea is configured with Workarea.config.auto_capture.

In v3.5, this is being deprecated to allow more flexibility based on the types
of items in the order.

You should set Workarea.config.checkout_payment_action instead. You can set it
for each type of order, here are the defaults:
  {
shipping: 'authorize!',
partial_shipping: 'authorize!',
no_shipping: 'purchase!'
  }

To achieve the same functionality as Workarea.config.auto_capture, you'd set:
  {
shipping: 'purchase!',
partial_shipping: 'purchase!',
no_shipping: 'purchase!'
  }

**************************************************
    eos
  end
end

#check_dragonfly_configObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/workarea/warnings.rb', line 46

def check_dragonfly_config
  if !Rails.env.test? && !Rails.env.development? &&
       Dragonfly.app(:workarea).datastore.is_a?(Dragonfly::FileDataStore)

    warn <<~eos
**************************************************
⛔️ WARNING: Dragonfly is configured to use the filesystem.

This means all dragonfly assets (assets, product images, etc.) will be stored
locally and not accessible to all servers within your environment.

We recommend using S3 when running in a live environment by setting
WORKAREA_S3_REGION and WORKAREA_S3_BUCKET_NAME in your environment variables.
Workarea will automatically configure Dragonfly to use S3 if those values
are present.
**************************************************
    eos
  end
end

#check_mongo_notable_scanObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/workarea/warnings.rb', line 27

def check_mongo_notable_scan
  if (Rails.env.development? &&
      !Workarea.config.skip_service_connections &&
      Configuration::Mongoid.indexes_enforced?)
    warn <<~eos
**************************************************
⛔️ WARNING: MongoDB is configured with notablescan.

This means that MongoDB won't run queries that require a collection scan and will return an error.
Workarea turns this on for running tests to assert that queries have indexes, and turns it off at the end of the test run.
Since you're not running in the test environment and this is turned on, it might mean the test process was killed, preventing Workarea from turning it off.

To turn this off, start the mongo shell and run this command:
db.getSiblingDB("admin").runCommand( { setParameter: 1, notablescan: 0 } )
**************************************************
    eos
  end
end

#check_timezoneObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/workarea/warnings.rb', line 12

def check_timezone
  if Rails.application.config.time_zone == 'UTC'
    warn <<~eos
**************************************************
⛔️ WARNING: Rails.application.config.time_zone is set to UTC, which you \
probably don't want.
As of Workarea 3.2, we use that value as the standard \
timezone for the admin side of the application.
We recommend setting this to the timezone of the retailer. Contact them to \
find their preference.
**************************************************
    eos
  end
end