Skip to content

Commit

Permalink
linter/syntax fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-domsch-sp committed Nov 11, 2024
1 parent 052b67a commit 897d4f5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/mysql2/aws_iam_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AwsTokenAuth

# Tokens are valid for up to 15 minutes.
# We will assume ours expire in 14 minutes to be safe.
TOKEN_EXPIRES_IN = (60*14) # 14 minutes
TOKEN_EXPIRES_IN = (60 * 14) # 14 minutes

def initialize
begin
Expand All @@ -25,7 +25,7 @@ def initialize
@generator = Aws::RDS::AuthTokenGenerator.new
end

def password(user, host port, opts)
def password(user, host, port, opts)
params = to_params(user, host, port, opts)
key = key_from_params(params)
passwd = nil
Expand All @@ -35,9 +35,10 @@ def password(user, host port, opts)
passwd = @passwords[key][:password]
end
rescue KeyError
passwd = nil
end
end
if passwd return passwd
return passwd unless passwd.nil?

AwsTokenAuth.instance.mutex.synchronize do
@passwords[key] = {}
Expand All @@ -59,8 +60,7 @@ def to_params(user, host, port, opts)
end

def key_from_params(params)
return "#{params[:user_name]}/#{params[:endpoint]}/#{params[:region]}"
"#{params[:user_name]}/#{params[:endpoint]}/#{params[:region]}"
end

end
end

0 comments on commit 897d4f5

Please sign in to comment.