Class: RorVsWild::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/installer.rb

Constant Summary collapse

PATH =
"config/rorvswild.yml"

Class Method Summary collapse

Class Method Details

.create_rails_config(api_key) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rorvswild/installer.rb', line 5

def self.create_rails_config(api_key)
  if File.directory?("config")
    if !File.exist?(PATH)
      File.write(PATH, template(api_key))
      puts "File #{PATH} has been created. Restart / deploy your app to start collecting data."
    else
      puts "File #{PATH} already exists."
    end
  else
    puts "There is no config directory to create #{PATH}."
  end
end

.template(api_key) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rorvswild/installer.rb', line 18

def self.template(api_key)
  <<YAML
development:
  # Widget position
  # widget: top-left, top-right, bottom-left, bottom-right or hidden

  # Open files in your text editor by clicking from the local widget.
  # VSCode: vscode://file${path}:${line}
  # Sublime: subl://${path}:${line}
  # It should be set with an env variable when developers are not using the same editor.
  editor_url: <%= ENV.fetch("RORVSWILD_EDITOR_URL", "vscode://file${path}:${line}") %>

production:
  api_key: #{api_key}
  # ignore_requests: # Do not monitor the following actions
  #   - SecretController#index
  # ignore_jobs: # Do not monitor the following jobs
  #   - SecretJob
  # ignore_exceptions: # Do not record the following exceptions
  #   - ActionController::RoutingError  # By default to ignore 404
  # ignore_plugins:
  #   - ActionController
  #   - ActionMailer
  #   - ActionView
  #   - ActiveJob
  #   - ActiveRecord
  #   - DelayedJob
  #   - Elasticsearch
  #   - Mongo
  #   - NetHttp
  #   - Redis
  #   - Resque
  #   - Sidekiq
  #
  # logger: log/rorvswild.log # By default it uses Rails.logger or Logger.new(STDOUT)
  #
  # # Deployment tracking is working without any actions from your part if the Rails app
  # # is inside a Git repositoriy, is deployed via Capistrano.
  # # In the other cases, you can provide the following details.
  # deployment:
  #   revision: <%= "Anything that will return the deployment version" %> # Mandatory
  #   description: <%= "Eventually if you have a description such as a Git message" %>
  #   author: <%= "Author's name of the deployment" %>
  #   email: <%= "[email protected]" %>
  #
  # Sampling allows to send a fraction of jobs and requests.
  # If your app is sending hundred of millions of requests per month,
  # you will probably get the same precision if you send only a fraction of it.
  # Thus, it decreases the bill at the end of the month. It's also a mitigation if
  # your app is a target of a DoS. There are 2 parameters to dissociate requests and jobs.
  # Indeed, for an app handling a lot of request but very few jobs, it makes sens to sample
  # the former but not the latter.
  # request_sampling_rate: 0.25 # 25% of requests are sent
  # job_sampling_rate: 0.5 # 50% of jobs are sent
YAML
end