@@ -107,8 +107,8 @@ Aws::String ComputeUserAgentString(ClientConfiguration const * const pConfig)
107
107
ss << " exec-env/" << FilterUserAgentToken (awsExecEnv.c_str ());
108
108
}
109
109
110
- const Aws::String& profile = pConfig ? pConfig->profileName : " default " ;
111
- Aws::String appId = ClientConfiguration::LoadConfigFromEnvOrProfile (" AWS_SDK_UA_APP_ID" , profile , " sdk_ua_app_id" , {}, " " );
110
+ const Aws::String& appId = pConfig ? pConfig->appId :
111
+ ClientConfiguration::LoadConfigFromEnvOrProfile (" AWS_SDK_UA_APP_ID" , " default " , " sdk_ua_app_id" , {}, " " );
112
112
if (!appId.empty ())
113
113
{
114
114
ss << " app/" << appId;
@@ -141,11 +141,14 @@ void setLegacyClientConfigurationParameters(ClientConfiguration& clientConfig)
141
141
clientConfig.enableClockSkewAdjustment = true ;
142
142
clientConfig.enableHostPrefixInjection = true ;
143
143
clientConfig.enableHttpClientTrace = false ;
144
- clientConfig.profileName = Aws::Auth::GetConfigProfileName ();
144
+ if (clientConfig.profileName .empty ())
145
+ {
146
+ clientConfig.profileName = Aws::Auth::GetConfigProfileName ();
147
+ }
145
148
146
149
Aws::String disableCompressionConfig = clientConfig.LoadConfigFromEnvOrProfile (
147
150
DISABLE_REQUEST_COMPRESSION_ENV_VAR,
148
- Aws::Auth::GetConfigProfileName () ,
151
+ clientConfig. profileName ,
149
152
DISABLE_REQUEST_COMPRESSION_CONFIG_VAR,
150
153
{" TRUE" , " FALSE" , " true" , " false" },
151
154
" false"
@@ -206,6 +209,14 @@ void setLegacyClientConfigurationParameters(ClientConfiguration& clientConfig)
206
209
client->SetEndpoint (ec2MetadataServiceEndpoint);
207
210
}
208
211
}
212
+
213
+ clientConfig.appId = clientConfig.LoadConfigFromEnvOrProfile (
214
+ " AWS_SDK_UA_APP_ID" ,
215
+ clientConfig.profileName ,
216
+ " sdk_ua_app_id" ,
217
+ {},
218
+ " "
219
+ );
209
220
}
210
221
211
222
void setConfigFromEnvOrProfile (ClientConfiguration &config)
@@ -271,6 +282,9 @@ ClientConfiguration::ClientConfiguration(const ClientConfigurationInitValues &co
271
282
ClientConfiguration::ClientConfiguration (const char * profile, bool shouldDisableIMDS)
272
283
{
273
284
this ->disableIMDS = shouldDisableIMDS;
285
+ if (profile && Aws::Config::HasCachedConfigProfile (profile)) {
286
+ this ->profileName = Aws::String (profile);
287
+ }
274
288
setLegacyClientConfigurationParameters (*this );
275
289
// Call EC2 Instance Metadata service only once
276
290
Aws::String ec2MetadataRegion;
@@ -293,7 +307,6 @@ ClientConfiguration::ClientConfiguration(const char* profile, bool shouldDisable
293
307
}
294
308
295
309
if (profile && Aws::Config::HasCachedConfigProfile (profile)) {
296
- this ->profileName = Aws::String (profile);
297
310
AWS_LOGSTREAM_DEBUG (CLIENT_CONFIG_TAG,
298
311
" Use user specified profile: [" << this ->profileName << " ] for ClientConfiguration." );
299
312
auto tmpRegion = Aws::Config::GetCachedConfigProfile (this ->profileName ).GetRegion ();
0 commit comments