Skip to content

Commit

Permalink
Minor fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
candanedo committed Feb 15, 2024
1 parent 40b1c08 commit 9a09224
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 8 additions & 1 deletion lib/use_paragon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "use_paragon/configuration"
require "use_paragon/base"
require "use_paragon/engine"
require "use_paragon/integration"
require "use_paragon/user"
require "use_paragon/version"
Expand All @@ -12,13 +11,21 @@
module UseParagon
# Configuration from initializer
class << self
def load!
register_rails_engine if rails?
end

def configuration
@configuration ||= Configuration.new
end

def configure
yield(configuration)
end

def register_rails_engine
require "use_paragon/engine"
end
end

class Error < StandardError; end
Expand Down
4 changes: 1 addition & 3 deletions lib/use_paragon/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ def connection
conn.request :authorization, "Bearer", generate_token
conn.request :json

if config.logger_enabled
conn.response :logger, Rails.logger, { errors: true, bodies: true }
end
conn.response :logger, Rails.logger, { errors: true, bodies: true } if config.logger_enabled

conn.response :json, content_type: "application/json"
conn.response :raise_error
Expand Down
5 changes: 4 additions & 1 deletion lib/use_paragon/engine.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# frozen_string_literal: true

module UseParagon
# Engine for Rails to include and precompile vendor assets
class Engine < ::Rails::Engine
initializer "use_paragon.assets.precompile" do |app|
app.config.assets.precompile += %w( useparagon/connect.js )
app.config.assets.precompile += %w[useparagon/connect.js]
end
end
end

0 comments on commit 9a09224

Please sign in to comment.