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
  • email_regex
    • Email validation regex
    • Default : ^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]2,6$
  • max_file_size_in_mb
    • Max allowed file upload size in mega bytes.
    • Default : 5
  • file_upload_types
    • Allowed file upload types
    • Default : 'txt,pdf,zip,tgz,gz,rar,jpg,jpeg,gif,png,tif,tiff,bmp,csv,xls,xlsx,doc,docx,ppt,pptx,psd,ai,css,js,mp3,mp4,m4a,m4v,mov,wav,wmv'
  • 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
  • file_protocol
    • Protocol for file urls
    • Default : http
  • 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
  • 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 = 'notifications@noreply.com'
  config.max_file_size_in_mb = 5
  config.session_expires_in_hours = 12 # this is used by DeleteExpiredSessionsJob to purge inaactive sessions from database
  config.compass_logger_path = "#{Rails.root}/log"
  config.file_assets_location = 'file_assets' # relative to Rails.root
  config.file_protocol = 'http'
  config.file_storage = :filesystem # Can be either :s3 or :filesystem
  config.s3_url_expires_in_seconds = 60
  config.s3_protocol = 'https' # Can be either 'http' or 'https'
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