ErpTechSvcs

This engine is implemented with the premise that services like logging, tracing and encryption would likely already exist in many organizations, so they are factored here so they can easily be re-implemented. There are default implementations here, and we track several excellent Rails projects as potential implementations of services like security and content/digital asset mgt.

Initializer Options

  • installation_domain
    • The domain that your Compass AE instance is installed at.
    • Default : 'localhost:3000'
  • login_url
    • Path to the login page.
    • Default : '/erp_app/login'
  • email_notifications_from
  • max_file_size_in_mb
    • Max allowed file upload size in mega bytes.
    • Default : 5
  • file_assets_location
    • Where you want file_assets to be saved to.
    • Default : file_assets
  • file_storage
    • File storage to use either s3 or filesystem.
    • Default : :filesystem
  • s3_url_expires_in_seconds
    • Set expiration in seconds on an S3 url to a secure file
    • Default : 60
  • s3_protocol
    • Protocol for S3 URLs
    • Default : https
  • s3_cache_expires_in_minutes
    • S3 assets are cached for performance. Set expiration lifetime here in minutes.
    • Default : 60
  • session_expires_in_hours
    • Used by DeleteExpiredSessionsJob to purge inaactive sessions from database.
    • Default : 12
  • compass_logger_path
    • Default : Rails.root/log

Override Initializer

To override these settings simple create a erp_tech_svcs.rb file in your initializers and override the config options you want

Rails.application.config.erp_tech_svcs.configure do |config|
  config.installation_domain = 'localhost:3000'
  config. = '/erp_app/login'
  config.email_notifications_from = '[email protected]'
  config.max_file_size_in_mb = 5
  config.file_assets_location = 'file_assets' # relative to Rails.root/
  config.s3_url_expires_in_seconds = 60 
  config.s3_protocol = 'https' # Can be either 'http' or 'https'
  config.file_storage = :filesystem # Can be either :s3 or :filesystem
  config.s3_cache_expires_in_minutes = 60 
  config.session_expires_in_hours = 12 # this is used by DeleteExpiredSessionsJob to purge inaactive sessions from database 
  config.compass_logger_path = "#{Rails.root}/log"
end
Rails.application.config.erp_tech_svcs.configure!

Notes

We use pdfkit and there is an initializer in erp_tech_svcs to set it up with some defaults. You will need to create your own initializer to overwrite this if you have wkhtmltopdf in another location

# config/initializers/pdfkit.rb
PDFKit.configure do |config|
  if RUBY_PLATFORM =~ /(:?mswin|mingw)/
    # set path to wkhtmltopdf on windows here
    config.wkhtmltopdf = '/opt/local/bin/wkhtmltopdf'
  else
    config.wkhtmltopdf = '/opt/local/bin/wkhtmltopdf'
  end

  config.default_options = {
    :page_size => 'Letter',
    :print_media_type => true,
    :disable_smart_shrinking => true,
    :dpi => 300,
    :no_background => true
#    :use_xserver => true
  }
end