question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using SSM parameter as ConfigurationSection

See original GitHub issue

Is it possible to use SSM parameter as ConfigurationSection?

For example parameter with name /example/settings/Logging with json value

{
"Level": "Information",
"SomethingElse": "Test"
}

And then use it like this?

public class Logging
{
    public string Level { get; set; }
    public string SomethingElse{ get; set; }
}

...

var configurationSection = configuration.GetSection(nameof(Logging));
services.Configure<Logging>(configurationSection);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
zack-schragcommented, Dec 19, 2019

@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));
}
2reactions
rshillingtoncommented, Aug 3, 2020

@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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Systems Manager Parameter Store
Parameter Store, a capability of AWS Systems Manager, provides secure, hierarchical storage for configuration data management and secrets management.
Read more >
Externalizing Configurations to AWS SSM Parameter Store ...
To access parameter store, open the AWS Console and search for Systems Manager in the services or the search bar. In the Systems...
Read more >
Configure Your App with SSM Parameter Store
You can work around this by using SSM Parameter Store parameters, and let your app fetch its configuration at boot time. Putting data...
Read more >
ASP.NET Core appsettings.json Runtime Loading From ...
Click on “Create parameter” and enter /development/SomeConfig/FirstValue under Name and as for a value, again, enter whatever you want. Add this parameter and ......
Read more >
Custom Provider for AWS SSM using Microsoft. ...
ConfigurationBuilders.Base; Have parameters in AWS SSM Parameter Store that have the same name (not counting the prefix) as parameters in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found