8
9
10
11
12
13
14
15
16
17
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
|
# File 'lib/tng/services/installer.rb', line 8
def self.configuration_template(rails: false)
= if rails
"return unless Rails.env.development?"
else
"if defined?(Rails) && Rails.respond_to?(:env)\n return unless Rails.env.development?\nend"
end
<<~RUBY
# frozen_string_literal: true
#{}
Tng.configure do |config|
# Get your API key from https://app.tng.sh/
config.api_key = ENV["TNG_API_KEY"]
config.base_url = ENV["API_BASE_URI"] || "https://app.tng.sh/"
# Test Helper File (optional - auto-detected if not set)
# Uncomment to override auto-detection with a custom path
# Default auto-detection checks: spec/rails_helper.rb, spec/spec_helper.rb, test/test_helper.rb
# config.test_helper_path = "spec/rails_helper.rb"
# Ignore paths (relative to project root)
# config.ignore_files = []
# config.ignore_folders = []
# Authentication Configuration
# Set to false if your application does not require authentication
# config.authentication_enabled = true
# ⚠️ IMPORTANT: AUTHENTICATION CONFIGURATION REQUIRED ⚠️
# You MUST configure your authentication methods below for TNG to work properly.
# Uncomment and modify the authentication_methods configuration:
# Authentication Methods (multiple methods supported)
# Supported authentication types: session, devise, jwt, token_auth, basic_auth, oauth, headers, custom, nil
# EXAMPLE: Uncomment and modify these examples to match your app's authentication:
# config.authentication_methods = [
# {
# method: "authenticate_user_via_session!",
# file_location: "app/controllers/application_controller.rb",
# auth_type: "session"
# },
# {
# method: "authenticate_user_via_api_key!",
# file_location: "app/controllers/application_controller.rb",
# auth_type: "headers"
# }
# ]
# ⚠️ Remember to configure your authentication methods above! ⚠️
end
RUBY
end
|