Skip to content

Commit 37cb8dc

Browse files
committed
Change the order of endpoint_url alias global variable handling and fix bug in incorrect variable used to retrieve value
- ENDPOINT_URL needs to be handled before BASE_URL because BASE_URL is always defined with a default value and will cause ENDPOINT_URL alias to be ignored - global variable was referencing config file variable name by accident
1 parent 84faf7c commit 37cb8dc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/softlayer/Config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ def Config.globals_settings
156156
result[:user_agent] = $SL_API_USER_AGENT || "softlayer-ruby #{VERSION}"
157157
result[:username] = $SL_API_USERNAME if $SL_API_USERNAME
158158

159-
if $SL_API_BASE_URL && ENDPOINT_URL_ALIAS.include?($SL_API_BASE_URL)
160-
result[:endpoint_url] = ($SL_API_BASE_URL == "API_PUBLIC_ENDPOINT" ? API_PUBLIC_ENDPOINT : API_PRIVATE_ENDPOINT)
161-
elsif $SL_API_ENDPOINT_URL && ENDPOINT_URL_ALIAS.include?($SL_API_ENDPOINT_URL)
159+
if $SL_API_ENDPOINT_URL && ENDPOINT_URL_ALIAS.include?($SL_API_ENDPOINT_URL)
162160
result[:endpoint_url] = ($SL_API_ENDPOINT_URL == "API_PUBLIC_ENDPOINT" ? API_PUBLIC_ENDPOINT : API_PRIVATE_ENDPOINT)
161+
elsif $SL_API_BASE_URL && ENDPOINT_URL_ALIAS.include?($SL_API_BASE_URL)
162+
result[:endpoint_url] = ($SL_API_BASE_URL == "API_PUBLIC_ENDPOINT" ? API_PUBLIC_ENDPOINT : API_PRIVATE_ENDPOINT)
163163
elsif ($SL_API_BASE_URL && ! ENDPOINT_URL_ALIAS.include?($SL_API_BASE_URL)) ||
164164
($SL_API_ENDPOINT_URL && ! ENDPOINT_URL_ALIAS.include?($SL_API_ENDPOINT_URL))
165-
result[:endpoint_url] = softlayer_section['base_url'] || softlayer_section['endpoint_url']
165+
result[:endpoint_url] = $SL_API_ENDPOINT_URL || $SL_API_BASE_URL
166166
end
167167

168168
begin

0 commit comments

Comments
 (0)