Initial commit - fresh start
This commit is contained in:
37
config/application.rb
Normal file
37
config/application.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
require_relative "boot"
|
||||
|
||||
require "rails/all"
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module SpreeStarter
|
||||
class Application < Rails::Application
|
||||
config.to_prepare do
|
||||
# Load application's model / class decorators
|
||||
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
||||
Rails.configuration.cache_classes ? require(c) : load(c)
|
||||
end
|
||||
end
|
||||
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 8.0
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||
config.autoload_lib(ignore: %w[assets tasks])
|
||||
|
||||
# Configuration for the application, engines, and railties goes here.
|
||||
#
|
||||
# These settings can be overridden in specific environments using the files
|
||||
# in config/environments, which are processed later.
|
||||
#
|
||||
# config.time_zone = "Central Time (US & Canada)"
|
||||
# config.eager_load_paths << Rails.root.join("extras")
|
||||
|
||||
# https://github.com/rails/rails/issues/45826
|
||||
config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone, ActiveSupport::HashWithIndifferentAccess]
|
||||
end
|
||||
end
|
||||
4
config/boot.rb
Normal file
4
config/boot.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||
11
config/cable.yml
Normal file
11
config/cable.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
development:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: spree_production
|
||||
100
config/database.yml
Normal file
100
config/database.yml
Normal file
@@ -0,0 +1,100 @@
|
||||
# PostgreSQL. Versions 9.3 and up are supported.
|
||||
#
|
||||
# Install the pg driver:
|
||||
# gem install pg
|
||||
# On macOS with Homebrew:
|
||||
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
||||
# On Windows:
|
||||
# gem install pg
|
||||
# Choose the win32 build.
|
||||
# Install PostgreSQL and put its /bin directory on your path.
|
||||
#
|
||||
# Configure Using Gemfile
|
||||
# gem "pg"
|
||||
#
|
||||
default: &default
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
# For details on connection pooling, see Rails configuration guide
|
||||
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
|
||||
development: &development
|
||||
<<: *default
|
||||
database: spree_starter_development
|
||||
host: <%= ENV.fetch('DB_HOST', 'localhost') %>
|
||||
username: <%= ENV.fetch('DB_USER', 'postgres') %>
|
||||
password: <%= ENV.fetch('DB_PASSWORD', 'password') %>
|
||||
port: <%= ENV.fetch('DB_PORT', 5432) %>
|
||||
# On MacOS some users are reporting crashes when first trying to access
|
||||
# the database. This workaround was suggested in this issue on `ruby-pg`:
|
||||
# https://github.com/ged/ruby-pg/issues/538
|
||||
gssencmode: disable
|
||||
|
||||
|
||||
# The specified database role being used to connect to PostgreSQL.
|
||||
# To create additional roles in PostgreSQL see `$ createuser --help`.
|
||||
# When left blank, PostgreSQL will use the default role. This is
|
||||
# the same name as the operating system user running Rails.
|
||||
#username: spree_starter
|
||||
|
||||
# The password associated with the PostgreSQL role (username).
|
||||
#password:
|
||||
|
||||
# Connect on a TCP socket. Omitted by default since the client uses a
|
||||
# domain socket that doesn't need configuration. Windows does not have
|
||||
# domain sockets, so uncomment these lines.
|
||||
#host: localhost
|
||||
|
||||
# The TCP port the server listens on. Defaults to 5432.
|
||||
# If your server runs on a different port number, change accordingly.
|
||||
#port: 5432
|
||||
|
||||
# Schema search path. The server defaults to $user,public
|
||||
#schema_search_path: myapp,sharedapp,public
|
||||
|
||||
# Minimum log levels, in increasing order:
|
||||
# debug5, debug4, debug3, debug2, debug1,
|
||||
# log, notice, warning, error, fatal, and panic
|
||||
# Defaults to warning.
|
||||
#min_messages: notice
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: spree_starter_test
|
||||
host: <%= ENV.fetch('DB_HOST', 'localhost') %>
|
||||
username: <%= ENV.fetch('DB_USER', 'postgres') %>
|
||||
password: <%= ENV.fetch('DB_PASSWORD', 'password') %>
|
||||
port: <%= ENV.fetch('DB_PORT', 5432) %>
|
||||
# On MacOS some users are reporting crashes when first trying to access
|
||||
# the database. This workaround was suggested in this issue on `ruby-pg`:
|
||||
# https://github.com/ged/ruby-pg/issues/538
|
||||
gssencmode: disable
|
||||
|
||||
|
||||
# As with config/credentials.yml, you never want to store sensitive information,
|
||||
# like your database password, in your source code. If your source code is
|
||||
# ever seen by anyone, they now have access to your database.
|
||||
#
|
||||
# Instead, provide the password or a full connection URL as an environment
|
||||
# variable when you boot the app. For example:
|
||||
#
|
||||
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
||||
#
|
||||
# If the connection URL is provided in the special DATABASE_URL environment
|
||||
# variable, Rails will automatically merge its configuration values on top of
|
||||
# the values provided in this file. Alternatively, you can specify a connection
|
||||
# URL environment variable explicitly:
|
||||
#
|
||||
# production:
|
||||
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
||||
#
|
||||
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||
# for a full overview on how database connection configuration can be specified.
|
||||
#
|
||||
production:
|
||||
<<: *default
|
||||
url: <%= ENV['DATABASE_URL'] %>
|
||||
5
config/environment.rb
Normal file
5
config/environment.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# Load the Rails application.
|
||||
require_relative "application"
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
83
config/environments/development.rb
Normal file
83
config/environments/development.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Make code changes take effect immediately without server restart.
|
||||
config.enable_reloading = true
|
||||
|
||||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable server timing.
|
||||
config.server_timing = true
|
||||
|
||||
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
||||
# Run rails dev:cache to toggle Action Controller caching.
|
||||
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
end
|
||||
|
||||
# Change to :null_store to avoid any caching.
|
||||
config.cache_store = :memory_store
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Make template changes take effect immediately.
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Set localhost to be used by links generated in mailer templates.
|
||||
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Highlight code that triggered database queries in logs.
|
||||
config.active_record.verbose_query_logs = true
|
||||
|
||||
# Append comments with runtime information tags to SQL queries in logs.
|
||||
config.active_record.query_log_tags_enabled = true
|
||||
|
||||
# Highlight code that enqueued background job in logs.
|
||||
config.active_job.verbose_enqueue_logs = true
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||
|
||||
# sidekiq
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
|
||||
# letter opener
|
||||
config.action_mailer.delivery_method = :letter_opener
|
||||
config.action_mailer.perform_deliveries = true
|
||||
|
||||
config.hosts << "18.141.239.213"
|
||||
config.action_controller.default_url_options = { host: "18.141.239.213", protocol: "http" }
|
||||
|
||||
end
|
||||
111
config/environments/production.rb
Normal file
111
config/environments/production.rb
Normal file
@@ -0,0 +1,111 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.enable_reloading = false
|
||||
|
||||
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled.
|
||||
config.consider_all_requests_local = false
|
||||
|
||||
# Turn on fragment caching in view templates.
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Cache assets for far-future expiry since they are all digest stamped.
|
||||
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.asset_host = "http://assets.example.com"
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||
config.assume_ssl = true
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = true
|
||||
|
||||
# Skip http-to-https redirect for the default health check endpoint.
|
||||
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
||||
|
||||
# Log to STDOUT with the current request id as a default log tag.
|
||||
config.log_tags = [ :request_id ]
|
||||
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
||||
|
||||
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
||||
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
||||
|
||||
# Prevent health checks from clogging up the logs.
|
||||
config.silence_healthcheck_path = "/up"
|
||||
|
||||
# Don't log any deprecations.
|
||||
config.active_support.report_deprecations = false
|
||||
|
||||
# Replace the default in-process memory cache store with a durable alternative.
|
||||
# https://guides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore
|
||||
if ENV['REDIS_CACHE_URL'].present?
|
||||
cache_servers = ENV['REDIS_CACHE_URL'].split(',') # if multiple instances are provided
|
||||
config.cache_store = :redis_cache_store, {
|
||||
url: cache_servers,
|
||||
connect_timeout: 30, # Defaults to 1 second
|
||||
read_timeout: 0.2, # Defaults to 1 second
|
||||
write_timeout: 0.2, # Defaults to 1 second
|
||||
reconnect_attempts: 2, # Defaults to 1
|
||||
}
|
||||
else
|
||||
config.cache_store = :memory_store
|
||||
end
|
||||
|
||||
# Replace the default in-process and non-durable queuing backend for Active Job.
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Set host to be used by links generated in mailer templates.
|
||||
# config.action_mailer.default_url_options = { host: "example.com" }
|
||||
|
||||
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
||||
if ENV['SENDGRID_API_KEY'].present?
|
||||
config.action_mailer.smtp_settings = {
|
||||
user_name: 'apikey', # This is the string literal 'apikey', NOT the ID of your API key
|
||||
password: ENV['SENDGRID_API_KEY'], # This is the secret sendgrid API key which was issued during API key creation
|
||||
domain: ENV.fetch('SENDGRID_DOMAIN', Rails.application.routes.default_url_options[:host]),
|
||||
address: 'smtp.sendgrid.net',
|
||||
port: 587,
|
||||
authentication: :plain,
|
||||
enable_starttls_auto: true
|
||||
}
|
||||
end
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
# Only use :id for inspections in production.
|
||||
config.active_record.attributes_for_inspect = [ :id ]
|
||||
|
||||
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||
# config.hosts = [
|
||||
# "example.com", # Allow requests from example.com
|
||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||
# ]
|
||||
#
|
||||
# Skip DNS rebinding protection for the default health check endpoint.
|
||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||
|
||||
# Fix for Render deployment
|
||||
# this will set the store URL to the render external URL during db:seeds for the first time
|
||||
if ENV['RENDER_EXTERNAL_URL'].present?
|
||||
Rails.application.routes.default_url_options[:host] = ENV['RENDER_EXTERNAL_URL']
|
||||
end
|
||||
end
|
||||
53
config/environments/test.rb
Normal file
53
config/environments/test.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# While tests run files are not watched, reloading is not necessary.
|
||||
config.enable_reloading = false
|
||||
|
||||
# Eager loading loads your entire application. When running a single test locally,
|
||||
# this is usually not necessary, and can slow down your test suite. However, it's
|
||||
# recommended that you enable it in continuous integration systems to ensure eager
|
||||
# loading is working properly before deploying your code.
|
||||
config.eager_load = ENV["CI"].present?
|
||||
|
||||
# Configure public file server for tests with cache-control for performance.
|
||||
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
config.cache_store = :null_store
|
||||
|
||||
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
||||
config.action_dispatch.show_exceptions = :rescuable
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Store uploaded files on the local file system in a temporary directory.
|
||||
config.active_storage.service = :test
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Set host to be used by links generated in mailer templates.
|
||||
config.action_mailer.default_url_options = { host: "example.com" }
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
end
|
||||
7
config/importmap.rb
Normal file
7
config/importmap.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# Pin npm packages by running ./bin/importmap
|
||||
|
||||
pin "application"
|
||||
pin "@hotwired/turbo-rails", to: "turbo.min.js"
|
||||
pin "@hotwired/stimulus", to: "stimulus.min.js"
|
||||
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
|
||||
pin_all_from "app/javascript/controllers", under: "controllers"
|
||||
2
config/initializers/active_storage.rb
Normal file
2
config/initializers/active_storage.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
Rails.application.config.active_storage.resolve_model_to_route = :rails_storage_proxy
|
||||
Rails.application.config.active_storage.variant_processor = :vips
|
||||
7
config/initializers/assets.rb
Normal file
7
config/initializers/assets.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
25
config/initializers/content_security_policy.rb
Normal file
25
config/initializers/content_security_policy.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide content security policy.
|
||||
# See the Securing Rails Applications Guide for more information:
|
||||
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
||||
|
||||
# Rails.application.configure do
|
||||
# config.content_security_policy do |policy|
|
||||
# policy.default_src :self, :https
|
||||
# policy.font_src :self, :https, :data
|
||||
# policy.img_src :self, :https, :data
|
||||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.style_src :self, :https
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
# end
|
||||
#
|
||||
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
||||
#
|
||||
# # Report violations without enforcing the policy.
|
||||
# # config.content_security_policy_report_only = true
|
||||
# end
|
||||
313
config/initializers/devise.rb
Normal file
313
config/initializers/devise.rb
Normal file
@@ -0,0 +1,313 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Assuming you have not yet modified this file, each configuration option below
|
||||
# is set to its default value. Note that some are commented out while others
|
||||
# are not: uncommented lines are intended to protect your configuration from
|
||||
# breaking changes in upgrades (i.e., in the event that future versions of
|
||||
# Devise change the default values for those options).
|
||||
#
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
# Devise will use the `secret_key_base` as its `secret_key`
|
||||
# by default. You can change it below and use your own secret key.
|
||||
config.secret_key = Rails.application.credentials.secret_key_base || ENV['SECRET_KEY_BASE']
|
||||
|
||||
# ==> Controller configuration
|
||||
# Configure the parent class to the devise controllers.
|
||||
config.parent_controller = 'Spree::BaseController'
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = ENV.fetch('MAIL_FROM_ADDRESS', "support@mystore.com")
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = 'Spree::DeviseMailer'
|
||||
|
||||
# Configure the parent class responsible to send e-mails.
|
||||
config.parent_mailer = 'Spree::BaseMailer'
|
||||
|
||||
# ==> ORM configuration
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||
# available as additional gems.
|
||||
require 'devise/orm/active_record'
|
||||
|
||||
# ==> Configuration for any authentication mechanism
|
||||
# Configure which keys are used when authenticating a user. The default is
|
||||
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||
# authenticating a user, both parameters are required. Remember that those
|
||||
# parameters are used only when authenticating and not when retrieving from
|
||||
# session. If you need permissions, you should implement that in a before filter.
|
||||
# You can also supply a hash where the value is a boolean determining whether
|
||||
# or not authentication should be aborted when the value is not present.
|
||||
# config.authentication_keys = [:email]
|
||||
|
||||
# Configure parameters from the request object used for authentication. Each entry
|
||||
# given should be a request method and it will automatically be passed to the
|
||||
# find_for_authentication method and considered in your model lookup. For instance,
|
||||
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||
# config.request_keys = []
|
||||
|
||||
# Configure which authentication keys should be case-insensitive.
|
||||
# These keys will be downcased upon creating or modifying a user and when used
|
||||
# to authenticate or find a user. Default is :email.
|
||||
config.case_insensitive_keys = [:email]
|
||||
|
||||
# Configure which authentication keys should have whitespace stripped.
|
||||
# These keys will have whitespace before and after removed upon creating or
|
||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||
config.strip_whitespace_keys = [:email]
|
||||
|
||||
# Tell if authentication through request.params is enabled. True by default.
|
||||
# It can be set to an array that will enable params authentication only for the
|
||||
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||
# enable it only for database (email + password) authentication.
|
||||
# config.params_authenticatable = true
|
||||
|
||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||
# It can be set to an array that will enable http authentication only for the
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||
# enable it only for database authentication.
|
||||
# For API-only applications to support authentication "out-of-the-box", you will likely want to
|
||||
# enable this with :database unless you are using a custom strategy.
|
||||
# The supported strategies are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# config.http_authenticatable = false
|
||||
|
||||
# If 401 status code should be returned for AJAX requests. True by default.
|
||||
# config.http_authenticatable_on_xhr = true
|
||||
|
||||
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||
config.http_authentication_realm = 'Spree Application'
|
||||
|
||||
# It will change confirmation, password recovery and other workflows
|
||||
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||
# Does not affect registerable.
|
||||
# config.paranoid = true
|
||||
|
||||
# By default Devise will store the user in session. You can skip storage for
|
||||
# particular strategies by setting this option.
|
||||
# Notice that if you are skipping storage for all authentication paths, you
|
||||
# may want to disable generating routes to Devise's sessions controller by
|
||||
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||
config.skip_session_storage = [:http_auth]
|
||||
|
||||
# By default, Devise cleans up the CSRF token on authentication to
|
||||
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||
# requests for sign in and sign up, you need to get a new CSRF token
|
||||
# from the server. You can disable this option at your own risk.
|
||||
# config.clean_up_csrf_token_on_authentication = true
|
||||
|
||||
# When false, Devise will not attempt to reload routes on eager load.
|
||||
# This can reduce the time taken to boot the app but if your application
|
||||
# requires the Devise mappings to be loaded during boot time the application
|
||||
# won't boot properly.
|
||||
# config.reload_routes = true
|
||||
|
||||
# ==> Configuration for :database_authenticatable
|
||||
# For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
||||
# using other algorithms, it sets how many times you want the password to be hashed.
|
||||
# The number of stretches used for generating the hashed password are stored
|
||||
# with the hashed password. This allows you to change the stretches without
|
||||
# invalidating existing passwords.
|
||||
#
|
||||
# Limiting the stretches to just one in testing will increase the performance of
|
||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
||||
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||
config.stretches = Rails.env.test? ? 1 : 12
|
||||
|
||||
# Set up a pepper to generate the hashed password.
|
||||
# config.pepper = 'c15d8d05f7bc89ed79d15ae9004c7ed6ca207358cc79f37daee6ac122752197c7ed3235d7d444901997fae450cc02f278399ef6423e3658b5ff1ab6e01188edf'
|
||||
|
||||
# Send a notification to the original email when the user's email is changed.
|
||||
# config.send_email_changed_notification = false
|
||||
|
||||
# Send a notification email when the user's password is changed.
|
||||
# config.send_password_change_notification = false
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
# confirming their account. For instance, if set to 2.days, the user will be
|
||||
# able to access the website for two days without confirming their account,
|
||||
# access will be blocked just in the third day.
|
||||
# You can also set it to nil, which will allow the user to access the website
|
||||
# without confirming their account.
|
||||
# Default is 0.days, meaning the user cannot access the website without
|
||||
# confirming their account.
|
||||
# config.allow_unconfirmed_access_for = 2.days
|
||||
|
||||
# A period that the user is allowed to confirm their account before their
|
||||
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||
# their account within 3 days after the mail was sent, but on the fourth day
|
||||
# their account can't be confirmed with the token any more.
|
||||
# Default is nil, meaning there is no restriction on how long a user can take
|
||||
# before confirming their account.
|
||||
# config.confirm_within = 3.days
|
||||
|
||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed, new email is stored in
|
||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
# config.confirmation_keys = [:email]
|
||||
|
||||
# ==> Configuration for :rememberable
|
||||
# The time the user will be remembered without asking for credentials again.
|
||||
# config.remember_for = 2.weeks
|
||||
|
||||
# Invalidates all the remember me tokens when the user signs out.
|
||||
config.expire_all_remember_me_on_sign_out = true
|
||||
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# Options to be passed to the created cookie. For instance, you can set
|
||||
# secure: true in order to force SSL only cookies.
|
||||
# config.rememberable_options = {}
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length.
|
||||
config.password_length = 6..128
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# one (and only one) @ exists in the given string. This is mainly
|
||||
# to give user feedback and not to assert the e-mail validity.
|
||||
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
||||
|
||||
# ==> Configuration for :timeoutable
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||
config.timeout_in = ENV.fetch('DEVISE_SESSION_TIMEOUT', 14).to_i.days
|
||||
|
||||
# ==> Configuration for :lockable
|
||||
# Defines which strategy will be used to lock an account.
|
||||
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||
# :none = No lock strategy. You should handle locking by yourself.
|
||||
# config.lock_strategy = :failed_attempts
|
||||
|
||||
# Defines which key will be used when locking and unlocking an account
|
||||
# config.unlock_keys = [:email]
|
||||
|
||||
# Defines which strategy will be used to unlock an account.
|
||||
# :email = Sends an unlock link to the user email
|
||||
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||
# :both = Enables both strategies
|
||||
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||
# config.unlock_strategy = :both
|
||||
|
||||
# Number of authentication tries before locking an account if lock_strategy
|
||||
# is failed attempts.
|
||||
# config.maximum_attempts = 20
|
||||
|
||||
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||
# config.unlock_in = 1.hour
|
||||
|
||||
# Warn on the last attempt before the account is locked.
|
||||
# config.last_attempt_warning = true
|
||||
|
||||
# ==> Configuration for :recoverable
|
||||
#
|
||||
# Defines which key will be used when recovering the password for an account
|
||||
# config.reset_password_keys = [:email]
|
||||
|
||||
# Time interval you can reset your password with a reset password key.
|
||||
# Don't put a too small interval or your users won't have the time to
|
||||
# change their passwords.
|
||||
config.reset_password_within = 6.hours
|
||||
|
||||
# When set to false, does not sign a user in automatically after their password is
|
||||
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
||||
# config.sign_in_after_reset_password = true
|
||||
|
||||
# ==> Configuration for :encryptable
|
||||
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
||||
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
||||
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
||||
# for default behavior) and :restful_authentication_sha1 (then you should set
|
||||
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
||||
#
|
||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
# are using only default views.
|
||||
# config.scoped_views = true
|
||||
|
||||
# Configure the default scope given to Warden. By default it's the first
|
||||
# devise role declared in your routes (usually :user).
|
||||
# config.default_scope = :user
|
||||
|
||||
# Set this configuration to false if you want /users/sign_out to sign out
|
||||
# only the current scope. By default, Devise signs out all scopes.
|
||||
# config.sign_out_all_scopes = true
|
||||
|
||||
# ==> Navigation configuration
|
||||
# Lists the formats that should be treated as navigational. Formats like
|
||||
# :html should redirect to the sign in page when the user does not have
|
||||
# access, but formats like :xml or :json, should return 401.
|
||||
#
|
||||
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||
# should add them to the navigational formats lists.
|
||||
#
|
||||
# The "*/*" below is required to match Internet Explorer requests.
|
||||
config.navigational_formats = ['*/*', :html, :turbo_stream]
|
||||
|
||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||
config.sign_out_via = :delete
|
||||
|
||||
# ==> OmniAuth
|
||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
# change the failure app, you can configure them inside the config.warden block.
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||
# is mountable, there are some extra configurations to be taken into account.
|
||||
# The following options are available, assuming the engine is mounted as:
|
||||
#
|
||||
# mount MyEngine, at: '/my_engine'
|
||||
#
|
||||
# The router that invoked `devise_for`, in the example above, would be:
|
||||
# config.router_name = :spree
|
||||
#
|
||||
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||
|
||||
# ==> Hotwire/Turbo configuration
|
||||
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||
# and some redirects must match the following. The default in Devise for existing
|
||||
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||
# these new defaults that match Hotwire/Turbo behavior.
|
||||
# Note: These might become the new default in future versions of Devise.
|
||||
config.responder.error_status = :unprocessable_entity
|
||||
config.responder.redirect_status = :see_other
|
||||
|
||||
# ==> Configuration for :registerable
|
||||
|
||||
# When set to false, does not sign a user in automatically after their password is
|
||||
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
||||
# config.sign_in_after_change_password = true
|
||||
end
|
||||
8
config/initializers/filter_parameter_logging.rb
Normal file
8
config/initializers/filter_parameter_logging.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
||||
# Use this to limit dissemination of sensitive information.
|
||||
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
||||
Rails.application.config.filter_parameters += [
|
||||
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
||||
]
|
||||
16
config/initializers/inflections.rb
Normal file
16
config/initializers/inflections.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, "\\1en"
|
||||
# inflect.singular /^(ox)en/i, "\\1"
|
||||
# inflect.irregular "person", "people"
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym "RESTful"
|
||||
# end
|
||||
30
config/initializers/new_framework_defaults_8_0.rb
Normal file
30
config/initializers/new_framework_defaults_8_0.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file eases your Rails 8.0 framework defaults upgrade.
|
||||
#
|
||||
# Uncomment each configuration one by one to switch to the new default.
|
||||
# Once your application is ready to run with all new defaults, you can remove
|
||||
# this file and set the `config.load_defaults` to `8.0`.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||
|
||||
###
|
||||
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
|
||||
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
|
||||
# If set to `:offset`, `to_time` methods will use the UTC offset.
|
||||
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
|
||||
#++
|
||||
# Rails.application.config.active_support.to_time_preserves_timezone = :zone
|
||||
|
||||
###
|
||||
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
|
||||
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
|
||||
# If set to `false` both conditions need to be satisfied.
|
||||
#++
|
||||
# Rails.application.config.action_dispatch.strict_freshness = true
|
||||
|
||||
###
|
||||
# Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
|
||||
#++
|
||||
# Regexp.timeout = 1
|
||||
13
config/initializers/permissions_policy.rb
Normal file
13
config/initializers/permissions_policy.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide HTTP permissions policy. For further
|
||||
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
||||
|
||||
# Rails.application.config.permissions_policy do |policy|
|
||||
# policy.camera :none
|
||||
# policy.gyroscope :none
|
||||
# policy.microphone :none
|
||||
# policy.usb :none
|
||||
# policy.fullscreen :self
|
||||
# policy.payment :self, "https://secure.example.com"
|
||||
# end
|
||||
30
config/initializers/sentry.rb
Normal file
30
config/initializers/sentry.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
if defined?(Sentry) && ENV['SENTRY_DSN'].present?
|
||||
Sentry.init do |config|
|
||||
config.dsn = ENV['SENTRY_DSN']
|
||||
config.breadcrumbs_logger = %i[active_support_logger http_logger]
|
||||
|
||||
# Set tracesSampleRate to 1.0 to capture 100%
|
||||
# of transactions for performance monitoring.
|
||||
# We recommend adjusting this value in production
|
||||
config.traces_sample_rate = 0.5
|
||||
|
||||
config.enabled_environments = %w[production staging]
|
||||
config.enabled_environments << 'development' if ENV['SENTRY_REPORT_ON_DEVELOPMENT'].present?
|
||||
|
||||
config.release = "spree@#{ENV['RENDER_GIT_COMMIT']}" if ENV['RENDER_GIT_COMMIT'].present?
|
||||
|
||||
config.excluded_exceptions = [
|
||||
'ActionController::RoutingError',
|
||||
'ActiveRecord::RecordNotFound',
|
||||
'Sidekiq::JobRetry::Skip',
|
||||
'Sidekiq::JobRetry::SilentRetry',
|
||||
'Aws::S3::Errors::NoSuchKey',
|
||||
'Aws::S3::Errors::NotFound',
|
||||
'ActiveStorage::FileNotFoundError'
|
||||
]
|
||||
|
||||
# Use native Rails error subscriber
|
||||
# https://guides.rubyonrails.org/error_reporting.html
|
||||
config.rails.register_error_subscriber = true
|
||||
end
|
||||
end
|
||||
5
config/initializers/sidekiq.rb
Normal file
5
config/initializers/sidekiq.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
Sidekiq.strict_args!(:warn) # https://github.com/sidekiq/sidekiq/blob/main/docs/7.0-Upgrade.md#strict-arguments
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }
|
||||
end
|
||||
94
config/initializers/spree.rb
Normal file
94
config/initializers/spree.rb
Normal file
@@ -0,0 +1,94 @@
|
||||
# Configure Spree Preferences
|
||||
#
|
||||
# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
|
||||
# If you would like users to be able to update a setting with the Admin it should NOT be set here.
|
||||
#
|
||||
# Note: If a preference is set here it will be stored within the cache & database upon initialization.
|
||||
# Just removing an entry from this initializer will not make the preference value go away.
|
||||
# Instead you must either set a new value or remove entry, clear cache, and remove database entry.
|
||||
#
|
||||
# In order to initialize a setting do:
|
||||
# config.setting_name = 'new value'
|
||||
#
|
||||
# More on configuring Spree preferences can be found at:
|
||||
# https://docs.spreecommerce.org/developer/customization
|
||||
Spree.config do |config|
|
||||
# Example:
|
||||
# Uncomment to stop tracking inventory levels in the application
|
||||
# config.track_inventory_levels = false
|
||||
end
|
||||
|
||||
# Background job queue names
|
||||
# Spree.queues.default = :default
|
||||
# Spree.queues.variants = :default
|
||||
# Spree.queues.stock_location_stock_items = :default
|
||||
# Spree.queues.coupon_codes = :default
|
||||
|
||||
# Use a CDN host for images, eg. Cloudfront
|
||||
# This is used in the frontend to generate absolute URLs to images
|
||||
# Default is nil and your application host will be used
|
||||
# Spree.cdn_host = 'cdn.example.com'
|
||||
|
||||
# Use a different service for storage (S3, google, etc)
|
||||
# unless Rails.env.test?
|
||||
# Spree.private_storage_service_name = :amazon_public # public assets, such as product images
|
||||
# Spree.public_storage_service_name = :amazon_private # private assets, such as invoices, etc
|
||||
# end
|
||||
|
||||
# Configure Spree Dependencies
|
||||
#
|
||||
# Note: If a dependency is set here it will NOT be stored within the cache & database upon initialization.
|
||||
# Just removing an entry from this initializer will make the dependency value go away.
|
||||
#
|
||||
# More on how to use Spree dependencies can be found at:
|
||||
# https://docs.spreecommerce.org/customization/dependencies
|
||||
Spree.dependencies do |dependencies|
|
||||
# Example:
|
||||
# Uncomment to change the default Service handling adding Items to Cart
|
||||
# dependencies.cart_add_item_service = 'MyNewAwesomeService'
|
||||
end
|
||||
|
||||
# Spree::Api::Dependencies.storefront_cart_serializer = 'MyRailsApp::CartSerializer'
|
||||
|
||||
# uncomment lines below to add your own custom business logic
|
||||
# such as promotions, shipping methods, etc
|
||||
Rails.application.config.after_initialize do
|
||||
# Rails.application.config.spree.shipping_methods << Spree::ShippingMethods::SuperExpensiveNotVeryFastShipping
|
||||
# Rails.application.config.spree.payment_methods << Spree::PaymentMethods::VerySafeAndReliablePaymentMethod
|
||||
|
||||
# Rails.application.config.spree.calculators.tax_rates << Spree::TaxRates::FinanceTeamForcedMeToCodeThis
|
||||
|
||||
# Rails.application.config.spree.stock_splitters << Spree::Stock::Splitters::SecretLogicSplitter
|
||||
|
||||
# Rails.application.config.spree.adjusters << Spree::Adjustable::Adjuster::TaxTheRich
|
||||
|
||||
# Custom promotions
|
||||
# Rails.application.config.spree.calculators.promotion_actions_create_adjustments << Spree::Calculators::PromotionActions::CreateAdjustments::AddDiscountForFriends
|
||||
# Rails.application.config.spree.calculators.promotion_actions_create_item_adjustments << Spree::Calculators::PromotionActions::CreateItemAdjustments::FinanceTeamForcedMeToCodeThis
|
||||
# Rails.application.config.spree.promotions.rules << Spree::Promotions::Rules::OnlyForVIPCustomers
|
||||
# Rails.application.config.spree.promotions.actions << Spree::Promotions::Actions::GiftWithPurchase
|
||||
|
||||
# Rails.application.config.spree.taxon_rules << Spree::TaxonRules::ProductsWithColor
|
||||
|
||||
# Rails.application.config.spree.exports << Spree::Exports::Payments
|
||||
# Rails.application.config.spree.reports << Spree::Reports::MassivelyOvercomplexReportForCfo
|
||||
|
||||
# Themes and page builder
|
||||
# Rails.application.config.spree.themes << Spree::Themes::NewShinyTheme
|
||||
# Rails.application.config.spree.theme_layout_sections << Spree::PageSections::SuperImportantCeoBio
|
||||
# Rails.application.config.spree.page_sections << Spree::PageSections::ContactFormToGetInTouch
|
||||
# Rails.application.config.spree.page_blocks << Spree::PageBlocks::BigRedButtonToCallSales
|
||||
|
||||
# Rails.application.config.spree_storefront.head_partials << 'spree/shared/that_js_snippet_that_marketing_forced_me_to_include'
|
||||
end
|
||||
|
||||
Spree.user_class = 'Spree::User'
|
||||
# Use a different class for admin users
|
||||
Spree.admin_user_class = 'Spree::AdminUser'
|
||||
|
||||
Spree.google_places_api_key = ENV['GOOGLE_PLACES_API_KEY'] if ENV['GOOGLE_PLACES_API_KEY'].present?
|
||||
Spree.screenshot_api_token = ENV['SCREENSHOT_API_TOKEN'] if ENV['SCREENSHOT_API_TOKEN'].present?
|
||||
|
||||
Rails.application.config.to_prepare do
|
||||
require_dependency 'spree/authentication_helpers'
|
||||
end
|
||||
65
config/locales/devise.en.yml
Normal file
65
config/locales/devise.en.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
|
||||
|
||||
en:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Your email address has been successfully confirmed."
|
||||
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||
failure:
|
||||
already_authenticated: "You are already signed in."
|
||||
inactive: "Your account is not activated yet."
|
||||
invalid: "Invalid %{authentication_keys} or password."
|
||||
locked: "Your account is locked."
|
||||
last_attempt: "You have one more attempt before your account is locked."
|
||||
not_found_in_database: "Invalid %{authentication_keys} or password."
|
||||
timeout: "Your session expired. Please sign in again to continue."
|
||||
unauthenticated: "You need to sign in or sign up before continuing."
|
||||
unconfirmed: "You have to confirm your email address before continuing."
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
subject: "Confirmation instructions"
|
||||
reset_password_instructions:
|
||||
subject: "Reset password instructions"
|
||||
unlock_instructions:
|
||||
subject: "Unlock instructions"
|
||||
email_changed:
|
||||
subject: "Email Changed"
|
||||
password_change:
|
||||
subject: "Password Changed"
|
||||
omniauth_callbacks:
|
||||
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||
success: "Successfully authenticated from %{kind} account."
|
||||
passwords:
|
||||
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
updated: "Your password has been changed successfully. You are now signed in."
|
||||
updated_not_active: "Your password has been changed successfully."
|
||||
registrations:
|
||||
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
||||
signed_up: "Welcome! You have signed up successfully."
|
||||
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
||||
updated: "Your account has been updated successfully."
|
||||
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
already_signed_out: "Signed out successfully."
|
||||
unlocks:
|
||||
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
||||
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||
errors:
|
||||
messages:
|
||||
already_confirmed: "was already confirmed, please try signing in"
|
||||
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||
expired: "has expired, please request a new one"
|
||||
not_found: "not found"
|
||||
not_locked: "was not locked"
|
||||
not_saved:
|
||||
one: "1 error prohibited this %{resource} from being saved:"
|
||||
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||
31
config/locales/en.yml
Normal file
31
config/locales/en.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# Files in the config/locales directory are used for internationalization and
|
||||
# are automatically loaded by Rails. If you want to use locales other than
|
||||
# English, add the necessary files in this directory.
|
||||
#
|
||||
# To use the locales, use `I18n.t`:
|
||||
#
|
||||
# I18n.t "hello"
|
||||
#
|
||||
# In views, this is aliased to just `t`:
|
||||
#
|
||||
# <%= t("hello") %>
|
||||
#
|
||||
# To use a different locale, set it with `I18n.locale`:
|
||||
#
|
||||
# I18n.locale = :es
|
||||
#
|
||||
# This would use the information in config/locales/es.yml.
|
||||
#
|
||||
# To learn more about the API, please read the Rails Internationalization guide
|
||||
# at https://guides.rubyonrails.org/i18n.html.
|
||||
#
|
||||
# Be aware that YAML interprets the following case-insensitive strings as
|
||||
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
||||
# must be quoted to be interpreted as strings. For example:
|
||||
#
|
||||
# en:
|
||||
# "yes": yup
|
||||
# enabled: "ON"
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
41
config/puma.rb
Normal file
41
config/puma.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
# This configuration file will be evaluated by Puma. The top-level methods that
|
||||
# are invoked here are part of Puma's configuration DSL. For more information
|
||||
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
||||
#
|
||||
# Puma starts a configurable number of processes (workers) and each process
|
||||
# serves each request in a thread from an internal thread pool.
|
||||
#
|
||||
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
||||
# should only set this value when you want to run 2 or more workers. The
|
||||
# default is already 1.
|
||||
#
|
||||
# The ideal number of threads per worker depends both on how much time the
|
||||
# application spends waiting for IO operations and on how much you wish to
|
||||
# prioritize throughput over latency.
|
||||
#
|
||||
# As a rule of thumb, increasing the number of threads will increase how much
|
||||
# traffic a given process can handle (throughput), but due to CRuby's
|
||||
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
||||
# response time (latency) of the application.
|
||||
#
|
||||
# The default is set to 3 threads as it's deemed a decent compromise between
|
||||
# throughput and latency for the average Rails application.
|
||||
#
|
||||
# Any libraries that use a connection pool or another resource pool should
|
||||
# be configured to provide at least as many connections as the number of
|
||||
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
port ENV.fetch("PORT", 3000)
|
||||
|
||||
# Allow puma to be restarted by `bin/rails restart` command.
|
||||
plugin :tmp_restart
|
||||
|
||||
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
||||
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||
|
||||
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
||||
# In other environments, only set the PID file if requested.
|
||||
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
||||
53
config/routes.rb
Normal file
53
config/routes.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
require "sidekiq/web" # require the web UI
|
||||
|
||||
Rails.application.routes.draw do
|
||||
Spree::Core::Engine.add_routes do
|
||||
# Storefront routes
|
||||
scope '(:locale)', locale: /#{Spree.available_locales.join('|')}/, defaults: { locale: nil } do
|
||||
devise_for(
|
||||
Spree.user_class.model_name.singular_route_key,
|
||||
class_name: Spree.user_class.to_s,
|
||||
path: :user,
|
||||
controllers: {
|
||||
sessions: 'spree/user_sessions',
|
||||
passwords: 'spree/user_passwords',
|
||||
registrations: 'spree/user_registrations'
|
||||
},
|
||||
router_name: :spree
|
||||
)
|
||||
end
|
||||
|
||||
# Admin authentication
|
||||
devise_for(
|
||||
Spree.admin_user_class.model_name.singular_route_key,
|
||||
class_name: Spree.admin_user_class.to_s,
|
||||
controllers: {
|
||||
sessions: 'spree/admin/user_sessions',
|
||||
passwords: 'spree/admin/user_passwords'
|
||||
},
|
||||
skip: :registrations,
|
||||
path: :admin_user,
|
||||
router_name: :spree
|
||||
)
|
||||
end
|
||||
# This line mounts Spree's routes at the root of your application.
|
||||
# This means, any requests to URLs such as /products, will go to
|
||||
# Spree::ProductsController.
|
||||
# If you would like to change where this engine is mounted, simply change the
|
||||
# :at option to something different.
|
||||
#
|
||||
# We ask that you don't use the :as option here, as Spree relies on it being
|
||||
# the default of "spree".
|
||||
mount Spree::Core::Engine, at: '/'
|
||||
|
||||
mount Sidekiq::Web => "/sidekiq" # access it at http://localhost:3000/sidekiq
|
||||
|
||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||
|
||||
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
||||
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
||||
get "up" => "rails/health#show", as: :rails_health_check
|
||||
|
||||
# Defines the root path route ("/")
|
||||
root "spree/home#index"
|
||||
end
|
||||
44
config/storage.yml
Normal file
44
config/storage.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
test:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("tmp/storage") %>
|
||||
|
||||
local:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("storage") %>
|
||||
|
||||
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||
# amazon:
|
||||
# service: S3
|
||||
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||
# region: us-east-1
|
||||
# bucket: your_own_bucket-<%= Rails.env %>
|
||||
|
||||
# Remember not to checkin your GCS keyfile to a repository
|
||||
# google:
|
||||
# service: GCS
|
||||
# project: your_project
|
||||
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||
# bucket: your_own_bucket-<%= Rails.env %>
|
||||
|
||||
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||
# microsoft:
|
||||
# service: AzureStorage
|
||||
# storage_account_name: your_account_name
|
||||
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||
# container: your_container_name-<%= Rails.env %>
|
||||
|
||||
# mirror:
|
||||
# service: Mirror
|
||||
# primary: local
|
||||
# mirrors: [ amazon, google, microsoft ]
|
||||
|
||||
cloudflare:
|
||||
service: S3
|
||||
endpoint: <%= ENV.fetch("CLOUDFLARE_ENDPOINT", "") %>
|
||||
access_key_id: <%= ENV.fetch("CLOUDFLARE_ACCESS_KEY_ID", "") %>
|
||||
secret_access_key: <%= ENV.fetch("CLOUDFLARE_SECRET_ACCESS_KEY", "") %>
|
||||
region: auto
|
||||
bucket: <%= ENV.fetch("CLOUDFLARE_BUCKET", "spree-#{Rails.env}") %>
|
||||
request_checksum_calculation: "when_required"
|
||||
response_checksum_validation: "when_required"
|
||||
128
config/tailwind.config.js
Normal file
128
config/tailwind.config.js
Normal file
@@ -0,0 +1,128 @@
|
||||
const defaultTheme = require("tailwindcss/defaultTheme");
|
||||
|
||||
module.exports = {
|
||||
content: [
|
||||
'public/*.html',
|
||||
'app/helpers/**/*.rb',
|
||||
'app/javascript/**/*.js',
|
||||
'app/views/spree/**/*.erb',
|
||||
'app/views/devise/**/*.erb',
|
||||
'app/views/themes/**/*.erb',
|
||||
process.env.SPREE_STOREFRONT_PATH + '/app/helpers/**/*.rb',
|
||||
process.env.SPREE_STOREFRONT_PATH + '/app/javascript/**/*.js',
|
||||
process.env.SPREE_STOREFRONT_PATH + '/app/views/themes/**/*.erb',
|
||||
process.env.SPREE_STOREFRONT_PATH + '/app/views/spree/**/*.erb',
|
||||
process.env.SPREE_STOREFRONT_PATH + '/app/views/devise/**/*.erb'
|
||||
],
|
||||
plugins: [
|
||||
require("@tailwindcss/typography"),
|
||||
require("@tailwindcss/forms"),
|
||||
require("@tailwindcss/aspect-ratio"),
|
||||
],
|
||||
variants: {
|
||||
scrollbar: ["rounded"],
|
||||
},
|
||||
safelist: [
|
||||
"hidden",
|
||||
"lg:grid",
|
||||
"grid",
|
||||
"text-xs",
|
||||
"text-sm",
|
||||
"text-base",
|
||||
"text-lg",
|
||||
"text-xl",
|
||||
"text-2xl",
|
||||
"text-3xl",
|
||||
"text-4xl",
|
||||
"text-left",
|
||||
"text-right",
|
||||
"text-center",
|
||||
"cursor-wait",
|
||||
"lg:sr-only",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: {
|
||||
body: ["var(--font-body)", ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
screens: {
|
||||
lg: { raw: "(min-width: 1024px) { &:not(.force-mobile-view *) }" },
|
||||
},
|
||||
animation: {
|
||||
fadeIn: "fadeIn 0.5s ease-in-out",
|
||||
},
|
||||
keyframes: {
|
||||
fadeIn: {
|
||||
"0%": { opacity: 0 },
|
||||
"100%": { opacity: 1 },
|
||||
},
|
||||
},
|
||||
colors: {
|
||||
primary: "var(--primary)",
|
||||
accent: "var(--accent)",
|
||||
neutral: "var(--neutral)",
|
||||
danger: "var(--danger)",
|
||||
success: "var(--success)",
|
||||
|
||||
"accent-100": "var(--accent-100)",
|
||||
"neutral-50": "var(--neutral-50)",
|
||||
"neutral-100": "var(--neutral-100)",
|
||||
"neutral-200": "var(--neutral-200)",
|
||||
"neutral-300": "var(--neutral-300)",
|
||||
"neutral-400": "var(--neutral-400)",
|
||||
"neutral-500": "var(--neutral-500)",
|
||||
"neutral-600": "var(--neutral-600)",
|
||||
"neutral-700": "var(--neutral-700)",
|
||||
"neutral-800": "var(--neutral-800)",
|
||||
"neutral-900": "var(--neutral-900)",
|
||||
|
||||
background: "var(--background)",
|
||||
"section-background": "var(--section-background, var(--background))",
|
||||
text: "var(--text)",
|
||||
|
||||
button: "rgba(var(--button-rgb), <alpha-value>)",
|
||||
"button-text": "var(--button-text)",
|
||||
"button-hover": "var(--button-hover)",
|
||||
"button-hover-text": "var(--button-hover-text)",
|
||||
|
||||
"secondary-button": "var(--secondary-button)",
|
||||
"secondary-button-text": "var(--secondary-button-text)",
|
||||
"secondary-button-hover": "var(--secondary-button-hover)",
|
||||
"secondary-button-hover-text": "var(--secondary-button-hover-text)",
|
||||
|
||||
"button-light": "var(--button-light)",
|
||||
"button-light-text": "var(--button-light-text)",
|
||||
"button-light-hover": "var(--button-light-hover)",
|
||||
"button-light-hover-text": "var(--button-light-hover-text)",
|
||||
|
||||
input: "var(--input)",
|
||||
"input-bg": "var(--input-bg)",
|
||||
"input-text": "var(--input-text)",
|
||||
"input-focus": "var(--input-focus)",
|
||||
"input-focus-bg": "var(--input-focus-bg)",
|
||||
"input-focus-text": "var(--input-focus-text)",
|
||||
},
|
||||
letterSpacing: {
|
||||
widest: "0.07rem",
|
||||
},
|
||||
typography: {
|
||||
DEFAULT: {
|
||||
css: {
|
||||
"--tw-prose-body": "var(--text)",
|
||||
"--tw-prose-headings": "var(--text)",
|
||||
"--tw-prose-bold": "var(--text)",
|
||||
"--tw-prose-links": "var(--text)",
|
||||
"--tw-prose-counters": "var(--text)",
|
||||
"--tw-prose-bullets": "var(--text)",
|
||||
"--tw-prose-lead": "var(--text)",
|
||||
"--tw-prose-hr": "var(--border-default-color)",
|
||||
"--tw-prose-th-borders": "var(--border-default-color)",
|
||||
"--tw-prose-td-borders": "var(--border-default-color)",
|
||||
"--tw-prose-quote-borders": "var(--border-default-color)",
|
||||
"--tw-prose-quotes": "var(--text)",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user