summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-06-17 22:33:24 -0400
committerrealtradam <[email protected]>2024-06-17 22:33:24 -0400
commit5fb193314230fd69a15b255aa713fef22f0b313b (patch)
tree4d6948682df4f48a06e02f65b7035a839b5c1ed3
parent39f2dc47ef9aa94b2fe30019715a9484000552a9 (diff)
downloadgameHolster-5fb193314230fd69a15b255aa713fef22f0b313b.tar.gz
gameHolster-5fb193314230fd69a15b255aa713fef22f0b313b.zip
change login to use new tab
-rw-r--r--.gitignore1
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock3
-rw-r--r--app/controllers/api/v1/auth_controller.rb6
-rw-r--r--config/application.rb27
5 files changed, 33 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 7e838dd..752ce8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@
# Ignore all environment files (except templates).
**/.env*
!*/.env*.erb
+**/env.toml
# Ignore all logfiles and tempfiles.
/log/*
diff --git a/Gemfile b/Gemfile
index 797e5b3..f2e4bb7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -35,6 +35,9 @@ gem "bootsnap", require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
gem "rack-cors"
+# Reading TOML files
+gem 'tomlib', '~> 0.7.2'
+
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ]
diff --git a/Gemfile.lock b/Gemfile.lock
index 952e0b2..37edfaa 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -187,6 +187,8 @@ GEM
stringio (3.1.1)
thor (1.3.1)
timeout (0.4.1)
+ tomlib (0.7.2)
+ bigdecimal
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2024.1)
@@ -214,6 +216,7 @@ DEPENDENCIES
rack-cors
rails (~> 7.1.3, >= 7.1.3.3)
rubyzip (~> 2.3)
+ tomlib (~> 0.7.2)
tzinfo-data
RUBY VERSION
diff --git a/app/controllers/api/v1/auth_controller.rb b/app/controllers/api/v1/auth_controller.rb
index 3a248cd..590be3b 100644
--- a/app/controllers/api/v1/auth_controller.rb
+++ b/app/controllers/api/v1/auth_controller.rb
@@ -14,8 +14,8 @@ class Api::V1::AuthController < ApplicationController
puts result
render json: result
else
- puts "Not logged in -- this should show up"
- render json: { info: "Not logged in -- change thingies" }, status: 401
+ puts "Not logged in"
+ render json: { info: "Not logged in" }, status: 401
end
end
def callback
@@ -51,7 +51,7 @@ class Api::V1::AuthController < ApplicationController
user.user_name = user_data["login"]
user.save
#redirect_to 'http://localhost:5173/', allow_other_host: true
- redirect_to 'https://malcz.com/', allow_other_host: true
+ redirect_to "#{ENV['ROOT_DOMAIN']}/closewindow", allow_other_host: true
end
private
diff --git a/config/application.rb b/config/application.rb
index 313b2a2..434df8d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,6 +1,7 @@
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.
@@ -33,15 +34,33 @@ module GamesHost
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', 'local_env.yml')
+ env_file = File.join(Rails.root, 'config', 'env.toml')
if File.exist?(env_file)
- YAML.load(File.open(env_file)).each do |key, value|
- ENV[key.to_s] = value
+ 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