Comments (11)
@DamirAinullin I also found that this worked for my situation:
public void ConfigureServices(IServiceCollection services)
{
var logging = new Logging();
Configuration.GetSection("Logging").Bind(logging);
services.AddSingleton(Options.Create(logging));
}
from aws-dotnet-extensions-configuration.
Hey @DamirAinullin, this does work, but the full hirarchy need to exist in the param name
So in your example it would be:
- Name: /example/settings/Logging/Level Value: Information
- Name: /example/settings/Logging/SomethingElse Value: Test
There would be too many different ways to anticipate what someone would want to put in a param for their custom hirarchy. You mentioned json in your example, but someone could want yaml, xml, etc.
Since in this case the parameter name is the hirarchy all of this is consistent, and each param is a simple key value pair.
from aws-dotnet-extensions-configuration.
@KenHundley What's not clear in your suggestion of flattening the JSON hierarchy to kvp is how arrays would be represented. For example in this fragment how would the "WriteTo" elements be set?
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.Seq" ],
"MinimumLevel": "Information",
"WriteTo": [
{ "Name": "Console" },
{ "Name": "Seq", "Args": { "serverUrl": "http://localhost:5341" } }
]
Update: As it turns out, you simply include the array index value as part of the path, so the above would be:
aws ssm put-parameter --name '/WriteTo/0/Name' --value Console
aws ssm put-parameter --name '/WriteTo/1/Name' --value Seq
etc...
from aws-dotnet-extensions-configuration.
I have added an alternative solution, that works for me. Would be nice if something like this could be merged into public solution.
from aws-dotnet-extensions-configuration.
I misunderstood the question the first time. I don't think this is possible at the moment, but I think it is something that we could add. I'll ask.
from aws-dotnet-extensions-configuration.
So you can manage this on your own if you target .NET Core 3.0 like follows:
public void ConfigureServices(IServiceCollection services)
{
var loggingConfig = new ConfigurationBuilder().AddJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(Configuration.GetSection("logging").Value))).Build();
services.Configure<Logging>(loggingConfig);
...
}
I'm not yet sure if we'll be able to support versions lower than that.
from aws-dotnet-extensions-configuration.
Thanks for the response. My target is netcore 2.1 (standard env for AWS lambda). I had to get method AddJsonStream and related sources from net core 3.0 to my code. And your approach works well. Do you know will Reload functionality and configurations.WaitForSystemsManagerReloadToComplete method be worked well in this case? BTW should I close the issue or you are going to make this feature available out of the box in future versions and then close it?
from aws-dotnet-extensions-configuration.
effectively you can think of this the same way as the AddEnvironmentVariables
. You can put whatever you want in the variable, but the provider just treats it as a kvp.
Here are the equilivant breakdowns for json, environment variables, and param store. This may help
JsonProvider:
{
"Logging": {
"Level": "Information",
"SomethingElse": "Test"
}
}
Environment Variables:
Logging:Level = Information
Logging:SomethingElse = Test
Param Store:
/prefix/Logging/Level = Inforamtion
/prefix/Logging/SomethingElse = Test
from aws-dotnet-extensions-configuration.
@KenHundley I understand your approach but it is difficult to manage params from web console when you have a lot of params for example more than hundreed. Probably should be another way how to manage them more convinient.
from aws-dotnet-extensions-configuration.
@DamirAinullin If by manage you mean populate SSM - I'm thinking about this as well. I put a discussion up on reddit for now, but will likely start building something soon. https://www.reddit.com/r/aws/comments/dwrtek/populating_ssm_in_a_sane_way_from_git_via_cicd/
We just starting using this library, and our goal is to have everything in git, ssm would just be the intermediary (or dynamo etc) without having to think too much about that.
from aws-dotnet-extensions-configuration.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
from aws-dotnet-extensions-configuration.
Related Issues (20)
- "AddSystemsManager" method doesn't work with DI and .Net 6 HOT 6
- Missing documentation for loading Secret Manager secrets as SSM parameters HOT 3
- AddSystemsManager Takes 1+ Minutes to Complete HOT 3
- JsonParameterProcessor::ProcessParameters fails when different objects share property names HOT 4
- Loading AppConfig feature flags into strong-type options HOT 7
- Support for the AWS Lambda Extension HOT 4
- NotImplementedException - application/json; charset=utf-8 HOT 6
- AddSystemsManager with SecretsManager path resolves parameters with ':' prefix HOT 4
- Missing dependency AWSSDK.SecurityToken ? HOT 5
- Duplicate SSM parameter with different Case cause the whole SSM parameter fail to load HOT 10
- 5.1.1 breaks existing application using StringList HOT 6
- amazon.extensions.configuration.systemsmanager is missing NuGet package README file
- AddAppConfig default encapsulation HOT 1
- Add manual reload ability HOT 3
- Mark project as not Native AoT ready HOT 3
- After updating from 6.1.0 to 6.1.1 loading data from param store takes 10s as oppose to 1s HOT 3
- Permissions section in readme.md incorrect. Required permission is ssm:GetParametersByPath not ssm:GetParameters HOT 2
- Better IConfigurationRoot::GetDebugView() support HOT 3
- Document how to use TOptions/binding with hierarchy HOT 4
- DuplicateParameterException can break a production application HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-dotnet-extensions-configuration.