eyeloupe 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a2fc3039c5a9cdcbd79a0a5639b74c52c3fc42f0c96fc569f92ce38255e7768
4
- data.tar.gz: 4de09b66849266fa6e43af59a55a60ab60464bb1310f8dff5a28a8e84904dac9
3
+ metadata.gz: fdc0f9276e2c518c9b396f1acbc856460fb3eabdf926cbd8940bc6f33a9ec19c
4
+ data.tar.gz: c3fa4ae7197c7de0bcbb3790bf0b4b1eb2bd93a6bee3ecca5030b4960b5c74ce
5
5
  SHA512:
6
- metadata.gz: 0c02695f8f4f26d09df3fda942691bf6729c9c1774b95acc1e9663e48c0ae25bad3d6991804a94163ff6595c8dbc8e56cb7f6dbd6f0be6eb195a2332446b5d9d
7
- data.tar.gz: b61c44badf4b0713186338a76d0a246c1f87586d88e8404861931b326aafcfc8945977222e2296fc3d10aee2eb2f369df99cdcc84d4a8c9bb508453f579a6927
6
+ metadata.gz: c7bf1df1813f5b9791ef17c39149179b7450ba7009d61950edd1bde80edad27be1fb1ea043516dd1c51637040874e05a096c5e9a5fbe5f22379c801e9a1c8943
7
+ data.tar.gz: e2e24fd0d42f2e430eea07f8395e4a3a2aa6ea0ffd02a44e290339ccc1feaf92fab07af6e2e175ac7cae4a0b95ba13c2c992ecef0d9d4f55cae96085c6cca995
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ - Add optional database config (thanks to @kiskoza).
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  - Add exceptions: Framework + ActiveJob + Sidekiq Worker exceptions.
@@ -10,4 +14,4 @@
10
14
 
11
15
  ## 0.1.0
12
16
 
13
- - Initial release including incoming and outgoing requests.
17
+ - Initial release including incoming and outgoing requests.
data/README.md CHANGED
@@ -64,6 +64,7 @@ Eyeloupe.configure do |config|
64
64
  config.capture = Rails.env.development?
65
65
  config.openai_access_key = "your-openai-access-key"
66
66
  config.openai_model = "gpt-4"
67
+ config.database = 'eyeloupe'
67
68
  end
68
69
  ```
69
70
 
@@ -71,6 +72,26 @@ end
71
72
  - `capture` is a boolean to enable/disable Eyeloupe capture. By default, it's set to `true`.
72
73
  - `openai_access_key` is the access key to use the OpenAI API. You can get one [here](https://platform.openai.com/).
73
74
  - `openai_model` is the model to use for the OpenAI API. You can find the list of available models [here](https://platform.openai.com/docs/models).
75
+ - `database` is an optional database config Eyeloupe will use ([Database](#database)).
76
+
77
+
78
+ ### Database
79
+
80
+ By default, Eyeloupe uses the same database as your application. If you want to use a different database to keep your production environment clean, you can add a new database config in your `config/database.yml` file:
81
+
82
+ ```yml
83
+ development:
84
+ primary:
85
+ <<: *default
86
+ database: db/development.sqlite3
87
+ eyeloupe:
88
+ <<: *default
89
+ database: db/eyeloupe.sqlite3
90
+ migrations_paths: <%= Gem.loaded_specs['eyeloupe'].full_gem_path + '/db/migrate' %>
91
+ schema_dump: false
92
+ ```
93
+
94
+ Using this you can skip the `eyeloupe:install:migrations` step, but do not forget to run `rails db:migrate RAILS_ENV=eyeloupe` to setup the database.
74
95
 
75
96
  ### Exception handling
76
97
 
@@ -1,5 +1,9 @@
1
1
  module Eyeloupe
2
2
  class ApplicationRecord < ActiveRecord::Base
3
3
  self.abstract_class = true
4
+
5
+ if Eyeloupe.configuration.database
6
+ connects_to database: { writing: Eyeloupe.configuration.database.to_sym, reading: Eyeloupe.configuration.database.to_sym }
7
+ end
4
8
  end
5
9
  end
@@ -5,6 +5,9 @@ module Eyeloupe
5
5
  class Configuration
6
6
  include Singleton
7
7
 
8
+ # @return [Symbol|Nil]
9
+ attr_accessor :database
10
+
8
11
  # @return [Array<String>]
9
12
  attr_accessor :excluded_paths
10
13
 
@@ -24,4 +27,4 @@ module Eyeloupe
24
27
  end
25
28
  end
26
29
 
27
- end
30
+ end
@@ -1,4 +1,4 @@
1
1
  module Eyeloupe
2
2
  # @return [String]
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyeloupe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Lion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-17 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets-rails