Module: Tpt::Rails

Defined in:
lib/tpt/rails.rb,
lib/tpt/rails.rb,
lib/tpt/rails/engine.rb,
lib/tpt/rails/version.rb,
app/jobs/tpt/rails/application_job.rb,
app/models/tpt/rails/application_event.rb,
app/models/tpt/rails/application_record.rb,
app/helpers/tpt/rails/application_helper.rb,
app/mailers/tpt/rails/application_mailer.rb,
app/models/tpt/rails/event_bridge_publisher.rb,
app/helpers/tpt/rails/event_bridge_test_helper.rb,
app/controllers/tpt/rails/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, EventBridgeTestHelper, Internal, PumaStatsCollector Classes: ApplicationController, ApplicationEvent, ApplicationJob, ApplicationMailer, ApplicationRecord, Config, ConfigurationGenerator, ContinuousIntegrationGenerator, DatadogFactory, Engine, ErrorTestsController, EventBridgePublisher, HealthChecksController, KubernetesGenerator, NotConfigured

Constant Summary collapse

VERSION =

Do not change this manually. Our tooling will do it automatically.

'1.8.0'

Class Method Summary collapse

Class Method Details

.configObject

:nodoc:



68
69
70
# File 'lib/tpt/rails.rb', line 68

def config # :nodoc:
  configured? ? @config : raise(NotConfigured)
end

.configure {|@config| ... } ⇒ Object

USAGE:

In your app in ‘config/initializers/tpt_rails.rb`:

Tpt::Rails.configure do |config|
  config.app_name = ''
  config.app_env = ''
  config.rollbar_access_token = ''
  config.rollbar_enabled = true/false
  config.datadog_statsd_url = ''
  config.health_check(:foo) {  }
  
end

See Tpt::Rails::Config in ‘lib/tpt/rails/config.rb` for a list of all configs.

Yields:



30
31
32
33
34
35
36
37
# File 'lib/tpt/rails.rb', line 30

def configure
  @config = Tpt::Rails::Config.new

  yield @config if block_given?

  @configured = true
  @config.setup
end

.configured?Boolean

Whether the ‘Tpt::Rails.configure` block has been run yet by the host application.

Returns:

  • (Boolean)


40
41
42
# File 'lib/tpt/rails.rb', line 40

def configured?
  @configured
end

.release_versionObject

This should be set by the deployment tool. E.g. Jenkins: git.io/JJFiD



73
74
75
# File 'lib/tpt/rails.rb', line 73

def release_version
  ENV['TPT_RELEASE_VERSION'].presence
end