graphql-stitching 1.4.3 → 1.5.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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/README.md +4 -2
  4. data/docs/README.md +1 -0
  5. data/docs/composer.md +1 -1
  6. data/docs/subscriptions.md +208 -0
  7. data/examples/subscriptions/.gitattributes +9 -0
  8. data/examples/subscriptions/.gitignore +35 -0
  9. data/examples/subscriptions/Gemfile +65 -0
  10. data/examples/subscriptions/README.md +38 -0
  11. data/examples/subscriptions/Rakefile +6 -0
  12. data/examples/subscriptions/app/channels/graphql_channel.rb +50 -0
  13. data/examples/subscriptions/app/controllers/graphql_controller.rb +44 -0
  14. data/examples/subscriptions/app/graphql/entities_schema.rb +42 -0
  15. data/examples/subscriptions/app/graphql/stitched_schema.rb +10 -0
  16. data/examples/subscriptions/app/graphql/subscriptions_schema.rb +54 -0
  17. data/examples/subscriptions/app/models/repository.rb +39 -0
  18. data/examples/subscriptions/app/views/graphql/client.html.erb +159 -0
  19. data/examples/subscriptions/bin/bundle +109 -0
  20. data/examples/subscriptions/bin/docker-entrypoint +8 -0
  21. data/examples/subscriptions/bin/importmap +4 -0
  22. data/examples/subscriptions/bin/rails +4 -0
  23. data/examples/subscriptions/bin/rake +4 -0
  24. data/examples/subscriptions/bin/setup +33 -0
  25. data/examples/subscriptions/config/application.rb +14 -0
  26. data/examples/subscriptions/config/boot.rb +4 -0
  27. data/examples/subscriptions/config/cable.yml +10 -0
  28. data/examples/subscriptions/config/credentials.yml.enc +1 -0
  29. data/examples/subscriptions/config/database.yml +25 -0
  30. data/examples/subscriptions/config/environment.rb +5 -0
  31. data/examples/subscriptions/config/environments/development.rb +74 -0
  32. data/examples/subscriptions/config/environments/production.rb +91 -0
  33. data/examples/subscriptions/config/environments/test.rb +64 -0
  34. data/examples/subscriptions/config/initializers/content_security_policy.rb +25 -0
  35. data/examples/subscriptions/config/initializers/filter_parameter_logging.rb +8 -0
  36. data/examples/subscriptions/config/initializers/inflections.rb +16 -0
  37. data/examples/subscriptions/config/initializers/permissions_policy.rb +13 -0
  38. data/examples/subscriptions/config/locales/en.yml +31 -0
  39. data/examples/subscriptions/config/master.key +1 -0
  40. data/examples/subscriptions/config/puma.rb +35 -0
  41. data/examples/subscriptions/config/routes.rb +8 -0
  42. data/examples/subscriptions/config/storage.yml +34 -0
  43. data/examples/subscriptions/config.ru +6 -0
  44. data/examples/subscriptions/db/seeds.rb +9 -0
  45. data/examples/subscriptions/public/404.html +17 -0
  46. data/examples/subscriptions/public/422.html +17 -0
  47. data/examples/subscriptions/public/500.html +16 -0
  48. data/examples/subscriptions/public/apple-touch-icon-precomposed.png +0 -0
  49. data/examples/subscriptions/public/apple-touch-icon.png +0 -0
  50. data/examples/subscriptions/public/favicon.ico +0 -0
  51. data/examples/subscriptions/public/robots.txt +1 -0
  52. data/lib/graphql/stitching/client.rb +18 -11
  53. data/lib/graphql/stitching/composer/resolver_config.rb +1 -1
  54. data/lib/graphql/stitching/composer/validate_resolvers.rb +7 -1
  55. data/lib/graphql/stitching/composer.rb +30 -27
  56. data/lib/graphql/stitching/executor/shaper.rb +1 -1
  57. data/lib/graphql/stitching/executor.rb +19 -11
  58. data/lib/graphql/stitching/http_executable.rb +3 -0
  59. data/lib/graphql/stitching/plan.rb +1 -1
  60. data/lib/graphql/stitching/planner.rb +21 -5
  61. data/lib/graphql/stitching/{skip_include.rb → request/skip_include.rb} +2 -2
  62. data/lib/graphql/stitching/request.rb +42 -4
  63. data/lib/graphql/stitching/resolver/arguments.rb +2 -2
  64. data/lib/graphql/stitching/resolver/keys.rb +2 -3
  65. data/lib/graphql/stitching/resolver.rb +3 -3
  66. data/lib/graphql/stitching/supergraph.rb +5 -2
  67. data/lib/graphql/stitching/util.rb +1 -0
  68. data/lib/graphql/stitching/version.rb +1 -1
  69. data/lib/graphql/stitching.rb +17 -1
  70. metadata +49 -3
@@ -0,0 +1,159 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>GraphiQL</title>
5
+ <style>
6
+ body {
7
+ height: 100%;
8
+ margin: 0;
9
+ width: 100%;
10
+ overflow: hidden;
11
+ }
12
+
13
+ #graphiql {
14
+ height: 100vh;
15
+ }
16
+ </style>
17
+ <!--
18
+ This GraphiQL example depends on Promise and fetch, which are available in
19
+ modern browsers, but can be "polyfilled" for older browsers.
20
+ GraphiQL itself depends on React DOM.
21
+ If you do not want to rely on a CDN, you can host these files locally or
22
+ include them directly in your favored resource bundler.
23
+ -->
24
+ <script
25
+ crossorigin
26
+ src="https://unpkg.com/react@18/umd/react.development.js"
27
+ ></script>
28
+ <script
29
+ crossorigin
30
+ src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
31
+ ></script>
32
+ <!--
33
+ These two files can be found in the npm module, however you may wish to
34
+ copy them directly into your environment, or perhaps include them in your
35
+ favored resource bundler.
36
+ -->
37
+ <script
38
+ src="https://unpkg.com/graphiql/graphiql.min.js"
39
+ type="application/javascript"
40
+ ></script>
41
+ <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
42
+ <!--
43
+ These are imports for the GraphIQL Explorer plugin.
44
+ -->
45
+ <script
46
+ src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
47
+ crossorigin
48
+ ></script>
49
+
50
+ <script
51
+ src="https://cdn.jsdelivr.net/npm/actioncable@5.2.8-1/lib/assets/compiled/action_cable.min.js"
52
+ crossorigin
53
+ ></script>
54
+
55
+ <link
56
+ rel="stylesheet"
57
+ href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"
58
+ />
59
+ </head>
60
+
61
+ <body>
62
+ <div id="graphiql">Loading...</div>
63
+ <script>
64
+ const actionCable = ActionCable.createConsumer();
65
+ console.log(actionCable);
66
+
67
+ function createActionCableFetcher(options) {
68
+ let currentChannel = null
69
+ const consumer = options.consumer
70
+ const url = options.url || "/graphql"
71
+ const channelName = options.channelName || "GraphqlChannel"
72
+
73
+ const subscriptionFetcher = async function*(graphqlParams, fetcherOpts) {
74
+ let isSubscription = false;
75
+ let nextPromiseResolve = null;
76
+
77
+ if (fetcherOpts.documentAST) {
78
+ let ops = fetcherOpts.documentAST.definitions.filter(op => op.kind == "OperationDefinition");
79
+ let op = ops.length < 2 ? ops[0] : ops.find(op => graphqlParams.operationName === op.name.value);
80
+ isSubscription = op && op.operation === 'subscription';
81
+ }
82
+
83
+ if (isSubscription) {
84
+ if (currentChannel) { currentChannel.unsubscribe() }
85
+ currentChannel = consumer.subscriptions.create(channelName,
86
+ {
87
+ connected: function() {
88
+ if (currentChannel) {
89
+ currentChannel.perform("execute", {
90
+ query: graphqlParams.query,
91
+ operationName: graphqlParams.operationName,
92
+ variables: graphqlParams.variables,
93
+ })
94
+ }
95
+ },
96
+
97
+ received: function(data) {
98
+ if (nextPromiseResolve) {
99
+ nextPromiseResolve({ value: data.result, done: false })
100
+ }
101
+ }
102
+ }
103
+ )
104
+
105
+ var iterator = {
106
+ [Symbol.asyncIterator]() {
107
+ return {
108
+ next() {
109
+ return new Promise((resolve, _reject) => {
110
+ nextPromiseResolve = resolve
111
+ })
112
+ },
113
+ return() {
114
+ if (currentChannel) {
115
+ currentChannel.unsubscribe()
116
+ currentChannel = null
117
+ }
118
+ return Promise.resolve({ value: null, done: true })
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ for await (const payload of iterator) {
125
+ yield payload
126
+ }
127
+ } else {
128
+ const fetchFn = options.fetch || window.fetch
129
+ yield fetchFn(url, {
130
+ method: "POST",
131
+ body: JSON.stringify({
132
+ query: graphqlParams.query,
133
+ operationName: graphqlParams.operationName,
134
+ variables: graphqlParams.variables,
135
+ }),
136
+ headers: {
137
+ 'content-type': 'application/json',
138
+ },
139
+ ... options.fetchOptions
140
+ }).then((r) => r.json())
141
+ return
142
+ }
143
+ }
144
+
145
+ return subscriptionFetcher
146
+ }
147
+
148
+ const railsFetcher = createActionCableFetcher({ consumer: actionCable, url: "/graphql" })
149
+
150
+ ReactDOM.createRoot(document.getElementById('graphiql')).render(
151
+ React.createElement(GraphiQL, {
152
+ fetcher: railsFetcher,
153
+ defaultEditorToolsVisibility: true,
154
+ plugins: [GraphiQLPluginExplorer.explorerPlugin()],
155
+ }),
156
+ );
157
+ </script>
158
+ </body>
159
+ </html>
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version ||
66
+ cli_arg_version ||
67
+ bundler_requirement_for(lockfile_version)
68
+ end
69
+
70
+ def bundler_requirement_for(version)
71
+ return "#{Gem::Requirement.default}.a" unless version
72
+
73
+ bundler_gem_version = Gem::Version.new(version)
74
+
75
+ bundler_gem_version.approximate_recommendation
76
+ end
77
+
78
+ def load_bundler!
79
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
80
+
81
+ activate_bundler
82
+ end
83
+
84
+ def activate_bundler
85
+ gem_error = activation_error_handling do
86
+ gem "bundler", bundler_requirement
87
+ end
88
+ return if gem_error.nil?
89
+ require_error = activation_error_handling do
90
+ require "bundler/version"
91
+ end
92
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94
+ exit 42
95
+ end
96
+
97
+ def activation_error_handling
98
+ yield
99
+ nil
100
+ rescue StandardError, LoadError => e
101
+ e
102
+ end
103
+ end
104
+
105
+ m.load_bundler!
106
+
107
+ if m.invoked_as_script?
108
+ load Gem.bin_path("bundler", "bundle")
109
+ end
@@ -0,0 +1,8 @@
1
+ #!/bin/bash -e
2
+
3
+ # If running the rails server then create or migrate existing database
4
+ if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
5
+ ./bin/rails db:prepare
6
+ fi
7
+
8
+ exec "${@}"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/application"
4
+ require "importmap/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args, exception: true)
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! "bin/rails db:prepare"
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! "bin/rails log:clear tmp:clear"
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! "bin/rails restart"
33
+ end
@@ -0,0 +1,14 @@
1
+ require_relative "boot"
2
+
3
+ require "rails/all"
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module Subscriptions
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 7.1
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: subscriptions_production
@@ -0,0 +1 @@
1
+ kc7oqupA92PHWoLMp0Rd/b52T1bVMbrGyLfTivb0hv6JbXoYtLQz60ybA3O4moEiU/zJa1kcz/9T2MZ0iOp/ah8vu864iljomLt8saNZrUfcTSDQvxyAYpbbWyyV0F0twf9TIbmWrSZep2usSMY5O5Tck4AAlv7Kld2+Fe7aAFtMLZCFclgOYvg+c3JyO0fW2UqYVRffWI6brTW+BCY6DShx7O4rYXLRUg831f5T3Ujz/c2tUUHI6V9Q/WvUbI4TZ3JwYh+cMF0ARNcWVcbHBcK4WYcKAlz8FdKPWp/CDhDJJt5dBbhCf/b1Hh/74qeLDR8zYCq6sPkdCvcYmL8ELjCoaNYh7RhV8e0SrJKpe8FyGck0Zgl0noteTu3yCAw42731BL88wagjcIe/B3SRLSLyvtya--xBs9lXK9DaXe8cVf--gj2alHD2yabXnsT+PJ9KMg==
@@ -0,0 +1,25 @@
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem "sqlite3"
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: storage/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: storage/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: storage/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative "application"
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,74 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.enable_reloading = true
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable server timing
18
+ config.server_timing = true
19
+
20
+ # Enable/disable caching. By default caching is disabled.
21
+ # Run rails dev:cache to toggle caching.
22
+ if Rails.root.join("tmp/caching-dev.txt").exist?
23
+ config.action_controller.perform_caching = true
24
+ config.action_controller.enable_fragment_cache_logging = true
25
+
26
+ config.cache_store = :memory_store
27
+ config.public_file_server.headers = {
28
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
29
+ }
30
+ else
31
+ config.action_controller.perform_caching = false
32
+
33
+ config.cache_store = :null_store
34
+ end
35
+
36
+ # Store uploaded files on the local file system (see config/storage.yml for options).
37
+ config.active_storage.service = :local
38
+
39
+ # Don't care if the mailer can't send.
40
+ config.action_mailer.raise_delivery_errors = false
41
+
42
+ config.action_mailer.perform_caching = false
43
+
44
+ # Print deprecation notices to the Rails logger.
45
+ config.active_support.deprecation = :log
46
+
47
+ # Raise exceptions for disallowed deprecations.
48
+ config.active_support.disallowed_deprecation = :raise
49
+
50
+ # Tell Active Support which deprecation messages to disallow.
51
+ config.active_support.disallowed_deprecation_warnings = []
52
+
53
+ # Raise an error on page load if there are pending migrations.
54
+ config.active_record.migration_error = :page_load
55
+
56
+ # Highlight code that triggered database queries in logs.
57
+ config.active_record.verbose_query_logs = true
58
+
59
+ # Highlight code that enqueued background job in logs.
60
+ config.active_job.verbose_enqueue_logs = true
61
+
62
+
63
+ # Raises error for missing translations.
64
+ # config.i18n.raise_on_missing_translations = true
65
+
66
+ # Annotate rendered view with file names.
67
+ # config.action_view.annotate_rendered_view_with_filenames = true
68
+
69
+ # Uncomment if you wish to allow Action Cable access from any origin.
70
+ # config.action_cable.disable_request_forgery_protection = true
71
+
72
+ # Raise error when a before_action's only/except options reference missing actions
73
+ config.action_controller.raise_on_missing_callback_actions = true
74
+ end
@@ -0,0 +1,91 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.enable_reloading = false
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
24
+ # config.public_file_server.enabled = false
25
+
26
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
27
+ # config.asset_host = "http://assets.example.com"
28
+
29
+ # Specifies the header that your server uses for sending files.
30
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
31
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
32
+
33
+ # Store uploaded files on the local file system (see config/storage.yml for options).
34
+ config.active_storage.service = :local
35
+
36
+ # Mount Action Cable outside main process or domain.
37
+ # config.action_cable.mount_path = nil
38
+ # config.action_cable.url = "wss://example.com/cable"
39
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
40
+
41
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
42
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
43
+ # config.assume_ssl = true
44
+
45
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
46
+ config.force_ssl = true
47
+
48
+ # Log to STDOUT by default
49
+ config.logger = ActiveSupport::Logger.new(STDOUT)
50
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
51
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
52
+
53
+ # Prepend all log lines with the following tags.
54
+ config.log_tags = [ :request_id ]
55
+
56
+ # "info" includes generic and useful information about system operation, but avoids logging too much
57
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
58
+ # want to log everything, set the level to "debug".
59
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
60
+
61
+ # Use a different cache store in production.
62
+ # config.cache_store = :mem_cache_store
63
+
64
+ # Use a real queuing backend for Active Job (and separate queues per environment).
65
+ # config.active_job.queue_adapter = :resque
66
+ # config.active_job.queue_name_prefix = "subscriptions_production"
67
+
68
+ config.action_mailer.perform_caching = false
69
+
70
+ # Ignore bad email addresses and do not raise email delivery errors.
71
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72
+ # config.action_mailer.raise_delivery_errors = false
73
+
74
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
+ # the I18n.default_locale when a translation cannot be found).
76
+ config.i18n.fallbacks = true
77
+
78
+ # Don't log any deprecations.
79
+ config.active_support.report_deprecations = false
80
+
81
+ # Do not dump schema after migrations.
82
+ config.active_record.dump_schema_after_migration = false
83
+
84
+ # Enable DNS rebinding protection and other `Host` header attacks.
85
+ # config.hosts = [
86
+ # "example.com", # Allow requests from example.com
87
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
88
+ # ]
89
+ # Skip DNS rebinding protection for the default health check endpoint.
90
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
91
+ end
@@ -0,0 +1,64 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
10
+
11
+ # While tests run files are not watched, reloading is not necessary.
12
+ config.enable_reloading = false
13
+
14
+ # Eager loading loads your entire application. When running a single test locally,
15
+ # this is usually not necessary, and can slow down your test suite. However, it's
16
+ # recommended that you enable it in continuous integration systems to ensure eager
17
+ # loading is working properly before deploying your code.
18
+ config.eager_load = ENV["CI"].present?
19
+
20
+ # Configure public file server for tests with Cache-Control for performance.
21
+ config.public_file_server.enabled = true
22
+ config.public_file_server.headers = {
23
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
24
+ }
25
+
26
+ # Show full error reports and disable caching.
27
+ config.consider_all_requests_local = true
28
+ config.action_controller.perform_caching = false
29
+ config.cache_store = :null_store
30
+
31
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
32
+ config.action_dispatch.show_exceptions = :rescuable
33
+
34
+ # Disable request forgery protection in test environment.
35
+ config.action_controller.allow_forgery_protection = false
36
+
37
+ # Store uploaded files on the local file system in a temporary directory.
38
+ config.active_storage.service = :test
39
+
40
+ config.action_mailer.perform_caching = false
41
+
42
+ # Tell Action Mailer not to deliver emails to the real world.
43
+ # The :test delivery method accumulates sent emails in the
44
+ # ActionMailer::Base.deliveries array.
45
+ config.action_mailer.delivery_method = :test
46
+
47
+ # Print deprecation notices to the stderr.
48
+ config.active_support.deprecation = :stderr
49
+
50
+ # Raise exceptions for disallowed deprecations.
51
+ config.active_support.disallowed_deprecation = :raise
52
+
53
+ # Tell Active Support which deprecation messages to disallow.
54
+ config.active_support.disallowed_deprecation_warnings = []
55
+
56
+ # Raises error for missing translations.
57
+ # config.i18n.raise_on_missing_translations = true
58
+
59
+ # Annotate rendered view with file names.
60
+ # config.action_view.annotate_rendered_view_with_filenames = true
61
+
62
+ # Raise error when a before_action's only/except options reference missing actions
63
+ config.action_controller.raise_on_missing_callback_actions = true
64
+ end
@@ -0,0 +1,25 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy.
4
+ # See the Securing Rails Applications Guide for more information:
5
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
6
+
7
+ # Rails.application.configure do
8
+ # config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+ #
19
+ # # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
+ # config.content_security_policy_nonce_directives = %w(script-src style-src)
22
+ #
23
+ # # Report violations without enforcing the policy.
24
+ # # config.content_security_policy_report_only = true
25
+ # end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4
+ # Use this to limit dissemination of sensitive information.
5
+ # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6
+ Rails.application.config.filter_parameters += [
7
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8
+ ]