[LYN-2151] Add argument to override aws profile and config file path (#994)

This commit is contained in:
Vincent Liu
2021-05-28 12:19:17 -07:00
committed by GitHub
parent 00e860f326
commit 9fb4ce59c4
12 changed files with 90 additions and 19 deletions
@@ -58,6 +58,19 @@ namespace AWSCore
return configFilePath;
}
AZStd::string AWSCoreConfiguration::GetResourceMappingConfigFolderPath() const
{
if (m_sourceProjectFolder.empty())
{
AZ_Warning(AWSCoreConfigurationName, false, ProjectSourceFolderNotFoundErrorMessage);
return "";
}
AZStd::string configFolderPath = AZStd::string::format(
"%s/%s", m_sourceProjectFolder.c_str(), AWSCoreResourceMappingConfigFolderName);
AzFramework::StringFunc::Path::Normalize(configFolderPath);
return configFolderPath;
}
void AWSCoreConfiguration::InitConfig()
{
InitSourceProjectFolderPath();
@@ -123,7 +136,7 @@ namespace AWSCore
auto profileNamePath = AZStd::string::format("%s%s",
AZ::SettingsRegistryMergeUtils::OrganizationRootKey, AWSCoreProfileNameKey);
m_settingsRegistry.Remove(profileNamePath);
m_profileName.clear();
m_profileName = AWSCoreDefaultProfileName;
auto resourceMappingConfigFileNamePath = AZStd::string::format("%s%s",
AZ::SettingsRegistryMergeUtils::OrganizationRootKey, AWSCoreResourceMappingConfigFileNameKey);
@@ -14,6 +14,7 @@
#include <AzCore/Utils/Utils.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AWSCoreInternalBus.h>
#include <Editor/UI/AWSCoreResourceMappingToolAction.h>
namespace AWSCore
@@ -108,17 +109,24 @@ namespace AWSCore
{
return "";
}
AZStd::string profileName = "default";
AWSCoreInternalRequestBus::BroadcastResult(profileName, &AWSCoreInternalRequests::GetProfileName);
AZStd::string configPath = "";
AWSCoreInternalRequestBus::BroadcastResult(configPath, &AWSCoreInternalRequests::GetResourceMappingConfigFolderPath);
if (m_isDebug)
{
return AZStd::string::format(
"%s debug %s --binaries_path %s --debug",
m_enginePythonEntryPath.c_str(), m_toolScriptPath.c_str(), m_toolQtBinDirectoryPath.c_str());
"%s debug %s --binaries_path %s --debug --profile %s --config_path %s", m_enginePythonEntryPath.c_str(),
m_toolScriptPath.c_str(), m_toolQtBinDirectoryPath.c_str(), profileName.c_str(), configPath.c_str());
}
else
{
return AZStd::string::format(
"%s %s --binaries_path %s",
m_enginePythonEntryPath.c_str(), m_toolScriptPath.c_str(), m_toolQtBinDirectoryPath.c_str());
"%s %s --binaries_path %s --profile %s --config_path %s", m_enginePythonEntryPath.c_str(),
m_toolScriptPath.c_str(), m_toolQtBinDirectoryPath.c_str(), profileName.c_str(), configPath.c_str());
}
}