Skip to content

Commit

Permalink
fix: auth base url value
Browse files Browse the repository at this point in the history
  • Loading branch information
danilogco committed Aug 30, 2021
1 parent 193d2fd commit 4dff91e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
After the Github and Rubygems authenticatication, push with the following command:

```sh
gem push --key github --host https://rubygems.pkg.github.com/quasar-flash brl_auth-0.2.0.gem
gem push --key github --host https://rubygems.pkg.github.com/quasar-flash brl_auth-0.1.0.1.gem
```

Don't forget to generate the release.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Create the config/initializers/brl.rb file and define:
```ruby
# Set the env variables
BRL.configure do |config|
config.auth_url_value = "https://xxx.hmra.com.br" # optional; default: https://hom.api.acesso.hmra.com.br
config.handshake = "XXXXXX-XXXXX-XXXX"
config.secret_key = "xxxxxxxxx"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/brl/auth/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Connection < Flash::Integration::Connection
ACCEPT = "application/json"
CONTENT_TYPE = "application/x-www-form-urlencoded"

def initialize(request_class: Faraday, base_url: BRL::Auth::BASE_URL)
def initialize(request_class: Faraday, base_url: BRL.configuration.auth_base_url)
super(request_class: request_class, base_url: base_url)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/brl/auth/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ module Auth
# Major - Incremented for incompatible changes with previous release (or big enough new features)
# Minor - Incremented for new backwards-compatible features + deprecations
# Patch - Incremented for backwards-compatible bug fixes
VERSION = "0.1.0"
VERSION = "0.1.0.1"
end
end
2 changes: 1 addition & 1 deletion lib/brl_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Configuration
attr_writer :auth_base_url, :handshake, :secret_key

def auth_base_url
@auth_base_url ||= ENV["BRL_AUTH_BASE_URL"]
@auth_base_url ||= BRL::Auth::BASE_URL
end

def handshake
Expand Down
5 changes: 2 additions & 3 deletions spec/brl_auth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
context "when configuration is not defined" do
it { expect(subject).not_to be_nil }

it { expect(subject.auth_base_url).to be_nil }
it { expect(subject.auth_base_url).to eq(described_class::BASE_URL) }

it { expect(subject.handshake).to be_nil }

Expand All @@ -59,14 +59,13 @@

context "when its configured by envs" do
before do
ENV["BRL_AUTH_BASE_URL"] = "auth_url_value"
ENV["BRL_HANDSHAKE"] = "handshake_value"
ENV["BRL_SECRET_KEY"] = "password_value"
end

it { expect(subject).not_to be_nil }

it { expect(subject.auth_base_url).to eq("auth_url_value") }
it { expect(subject.auth_base_url).to eq(described_class::BASE_URL) }

it { expect(subject.handshake).to eq("handshake_value") }

Expand Down

0 comments on commit 4dff91e

Please sign in to comment.