Module: Apphunk::Config

Defined in:
lib/apphunk/config.rb

Overview

Used to configure the behaviour of Apphunk and its outgoing messages. Each option can be overriden by Apphunk.log’s option parameter. If Apphunk is used as part of a Rails application, the configuration should go to config/initializers/apphunk.rb.

Note: The configuration must be set using Apphunk.config as shown in the example below.

Example

Apphunk.config do |config|
  config.token = "secret_project_token"
end

Class Attribute Summary collapse

Class Attribute Details

.environmentObject

The current environment. Automatically retrieved if Apphunk is running as part of a Rails app.

Example

config.environment = 'production'


21
22
23
# File 'lib/apphunk/config.rb', line 21

def environment
  @environment
end

.environmentsObject

A list of allowed environments. Apphunk will only send messages if Apphunk::Config.environment is part of these allowed environments. Note: This step is skipped if Apphunk::Config.environment is empty.

Example

config.environments = %w(production staging)


29
30
31
# File 'lib/apphunk/config.rb', line 29

def environments
  @environments
end

.tagsObject

A list of tags to be send with each message.

Example

config.tags = 'each, message, will, get, these, tags'


36
37
38
# File 'lib/apphunk/config.rb', line 36

def tags
  @tags
end

.tokenObject

The token as provided by apphunk.com. Used to authenticate a message request.

Example

config.token = 'secrect_project_token'


43
44
45
# File 'lib/apphunk/config.rb', line 43

def token
  @token
end

.trailsObject

A list of trails to be send with each message.

Example

config.trails = { :product => 'Car', :country => 'Germany' }


50
51
52
# File 'lib/apphunk/config.rb', line 50

def trails
  @trails
end