lantern-rails 0.2.2 → 0.3.0
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 +4 -4
- data/README.md +8 -34
- data/lib/generators/lantern/install_generator.rb +23 -0
- data/lib/generators/lantern/templates/lantern.rb.tt +11 -0
- data/lib/lantern/rails/railtie.rb +18 -3
- data/lib/lantern/rails/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e80b02c09f20e01a8a0b0f4f502708feba44f3d8bffaa9cf0bbded0ee2bf079
|
|
4
|
+
data.tar.gz: 4dba6effb791874dbd11fe35d125b6637668b75792f3fd3c0efe9bf1069e9fcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0feab9b70da80d79b7455d28703ce83cc252520ca75988976751efea292d4bd201b8ecd25e133f4050f9a7be32f96a1b54b2fade5539eed629b16299fbe15f2d
|
|
7
|
+
data.tar.gz: 20c7cc314a052d6bc9d12de1b4175bc5b83b8f0670cb06ba4c20505f577bb6837d3c61c43c86f14ef10f7e4e68cf4b3acd4eda3548ec5e41b692780beb125f0c
|
data/README.md
CHANGED
|
@@ -16,50 +16,24 @@ Then run:
|
|
|
16
16
|
bundle install
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Quick start
|
|
20
20
|
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
3. Create an initializer
|
|
24
|
-
|
|
25
|
-
### Store your API key
|
|
26
|
-
|
|
27
|
-
**Option A: Environment variable**
|
|
21
|
+
1. Sign up for a free API key at [uselantern.dev](https://uselantern.dev)
|
|
22
|
+
2. Run the installer:
|
|
28
23
|
|
|
29
24
|
```
|
|
30
|
-
|
|
25
|
+
rails generate lantern:install
|
|
31
26
|
```
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
3. Add your API key to the generated initializer (`config/initializers/lantern.rb`) via environment variable or Rails credentials:
|
|
34
29
|
|
|
35
30
|
```
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Flat:
|
|
40
|
-
```yaml
|
|
41
|
-
lantern_api_key: lnt_your_key_here
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Or nested:
|
|
45
|
-
```yaml
|
|
46
|
-
lantern:
|
|
47
|
-
api_key: lnt_your_key_here
|
|
31
|
+
LANTERN_API_KEY=lnt_your_key_here
|
|
48
32
|
```
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```ruby
|
|
53
|
-
# config/initializers/lantern.rb
|
|
54
|
-
Lantern::Rails.configure do |config|
|
|
55
|
-
# Match how you stored the key above:
|
|
56
|
-
config.api_key = ENV["LANTERN_API_KEY"]
|
|
57
|
-
# Or: config.api_key = Rails.application.credentials.lantern_api_key
|
|
58
|
-
# Or: config.api_key = Rails.application.credentials.dig(:lantern, :api_key)
|
|
59
|
-
end
|
|
60
|
-
```
|
|
34
|
+
4. Deploy — Lantern starts collecting automatically.
|
|
61
35
|
|
|
62
|
-
That's it.
|
|
36
|
+
That's it. Open [uselantern.dev](https://uselantern.dev) to see your dashboard.
|
|
63
37
|
|
|
64
38
|
## Configuration
|
|
65
39
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Lantern
|
|
2
|
+
class InstallGenerator < ::Rails::Generators::Base
|
|
3
|
+
source_root File.expand_path("templates", __dir__)
|
|
4
|
+
|
|
5
|
+
desc "Creates a Lantern initializer with your API key."
|
|
6
|
+
|
|
7
|
+
def copy_initializer
|
|
8
|
+
template "lantern.rb.tt", "config/initializers/lantern.rb"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def print_next_steps
|
|
12
|
+
say ""
|
|
13
|
+
say "Lantern installed!", :green
|
|
14
|
+
say ""
|
|
15
|
+
say "Next steps:"
|
|
16
|
+
say " 1. Add your API key to config/initializers/lantern.rb"
|
|
17
|
+
say " Get your free key at: https://uselantern.dev"
|
|
18
|
+
say " 2. Deploy your app — Lantern starts collecting automatically"
|
|
19
|
+
say " 3. Open https://uselantern.dev to see your dashboard"
|
|
20
|
+
say ""
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Lantern::Rails.configure do |config|
|
|
2
|
+
# Your API key from https://uselantern.dev
|
|
3
|
+
# Sign up for free, add a database, and copy the key here.
|
|
4
|
+
config.api_key = Rails.application.credentials.dig(:lantern, :api_key) || ENV["LANTERN_API_KEY"]
|
|
5
|
+
|
|
6
|
+
# Collection interval in seconds (default: 300 = 5 minutes)
|
|
7
|
+
# config.interval = 300
|
|
8
|
+
|
|
9
|
+
# Environments to collect in (default: production and staging)
|
|
10
|
+
# config.collect_in_environments = %w[production staging]
|
|
11
|
+
end
|
|
@@ -11,9 +11,24 @@ module Lantern
|
|
|
11
11
|
|
|
12
12
|
config.after_initialize do
|
|
13
13
|
config = Lantern::Rails.configuration
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
unless config.valid?
|
|
16
|
+
::Rails.logger.info(
|
|
17
|
+
"[Lantern] No API key configured. Get your free key at https://uselantern.dev " \
|
|
18
|
+
"then run: rails generate lantern:install"
|
|
19
|
+
)
|
|
20
|
+
next
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
unless config.enabled
|
|
24
|
+
::Rails.logger.info("[Lantern] Disabled via configuration.")
|
|
25
|
+
next
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
unless config.collect_in_environments.include?(::Rails.env.to_s)
|
|
29
|
+
::Rails.logger.info("[Lantern] Skipping collection in #{::Rails.env} environment.")
|
|
30
|
+
next
|
|
31
|
+
end
|
|
17
32
|
|
|
18
33
|
runner = Lantern::Rails::Runner.new(config)
|
|
19
34
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lantern-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Mumbower
|
|
@@ -29,6 +29,8 @@ extra_rdoc_files: []
|
|
|
29
29
|
files:
|
|
30
30
|
- LICENSE
|
|
31
31
|
- README.md
|
|
32
|
+
- lib/generators/lantern/install_generator.rb
|
|
33
|
+
- lib/generators/lantern/templates/lantern.rb.tt
|
|
32
34
|
- lib/lantern-rails.rb
|
|
33
35
|
- lib/lantern/rails/collector.rb
|
|
34
36
|
- lib/lantern/rails/configuration.rb
|