diff options
Diffstat (limited to 'rails-backend/config/application.rb')
| -rw-r--r-- | rails-backend/config/application.rb | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/rails-backend/config/application.rb b/rails-backend/config/application.rb new file mode 100644 index 0000000..6e54549 --- /dev/null +++ b/rails-backend/config/application.rb @@ -0,0 +1,68 @@ +require_relative "boot" + +require "rails/all" +require 'tomlib' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module GameHolster + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.1 + + # 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") + + # Only loads a smaller set of middleware suitable for API only apps. + # Middleware like session, flash, cookies can be added back manually. + # Skip views, helpers and assets when generating a new resource. + config.api_only = true + + config.middleware.use ActionDispatch::Cookies + config.middleware.use ActionDispatch::Session::CookieStore + + config.active_storage.content_types_allowed_inline << "text/html" + + #localhost:5173 + #config.session_store :cookie_store, key: 'session', domain: :all, tld_length: 5 + + #config.before_configuration do + # env_file = File.join(Rails.root, 'config', 'local_env.yml') + # if File.exist?(env_file) + # YAML.load(File.open(env_file)).each do |key, value| + # ENV[key.to_s] = value + # end + # end + #end + config.before_configuration do + env_file = File.join(Rails.root, 'config', 'env.toml') + if File.exist?(env_file) + env = Tomlib.load(File.read(env_file)) + env['default'].each do |key, value| + ENV[key] = value + end + if Rails.env.production? + env['production'].each do |key, value| + ENV[key] = value + end + elsif Rails.env.development? + env['development'].each do |key, value| + ENV[key] = value + end + end + end + end + end +end |
