-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config framework implementation #17545
Conversation
src/Accounts/Authentication/Config/ConfigExample/RetryConfig.cs
Outdated
Show resolved
Hide resolved
src/Accounts/AuthenticationAssemblyLoadContext/AuthenticationAssemblyLoadContext.csproj
Outdated
Show resolved
Hide resolved
src/Accounts/Authentication/Config/Internal/ConfigurationRoot.cs
Outdated
Show resolved
Hide resolved
``` | ||
|
||
## DESCRIPTION | ||
{{ Fill in the Description }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs will be updated in a following PR.
I merely included them for CI.
} | ||
} | ||
|
||
// todo: tests initializes configs in a different way. Maybe there should be an abstraction IConfigInitializer and two concrete classes ConfigInitializer + TestConfigInitializer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactoring is low priority
configManager.BuildConfig(); | ||
} | ||
|
||
private void RegisterConfigs(IConfigManager configManager) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method will be implemented in a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is great that those code can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
public static class AppliesToHelper | ||
{ | ||
internal static readonly Regex ModulePattern = new Regex(@"^az\.[a-z]+$", RegexOptions.IgnoreCase); | ||
internal static readonly Regex CmdletPattern = new Regex(@"^[a-z]+-[a-z]+$", RegexOptions.IgnoreCase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cmdlet may contains digital number. such as Get-AzDataFactoryV2
I recommend that module supports digital number too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added numbers to the regex and moved the logic of handling regex into a new PSNamingUtilities
class.
@@ -30,4 +30,8 @@ | |||
</EmbeddedResource> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this part? it seems it is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
private bool IsMultiContent(object value) | ||
{ | ||
return value is Array; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems not required. nice to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, nice to have.
A general question. If class is defined as interface, why is its namespace internal? |
The code in the internal namespace works as the data layer of the config framework. It is not supposed to be exposed as public API, so I made it explicit by the namespace. |
This PR implements the abstractions defined in Azure/azure-powershell-common#313
You can review this PR by commits:
ConfigManager
which provides all the CRUD APIs to the config; andConfigInitializer
which initializes the config file and config manager. This commit also includes helper classes and abstract config definitions.Get-AzConfig
.Description
Checklist
CONTRIBUTING.md
ChangeLog.md
file(s) has been updated:ChangeLog.md
file can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
## Upcoming Release
header -- no new version header should be added