Skip to content
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

AspNetCore: Add automatic configuration #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

natehitze
Copy link

Adds support for pulling configuration from DI. Also adds support for options reconfiguration.

Based on ConsoleLogger: https://github.com/aspnet/Extensions/tree/2.2.0/src/Logging/Logging.Console/src

@natehitze natehitze changed the title Added automatic configuration AspNetCore: Add automatic configuration Jul 25, 2019
Copy link
Contributor

@guptakeshav-sumo guptakeshav-sumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please give a little more context on what are we trying to achieve by support for pulling configuration from DI?

public LoggerProvider(IOptionsMonitor<LoggerOptions> options)
{
optionsReloadToken = options.OnChange(ReConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionsReloadDisposable / optionsOnChangeDisposable or something like that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you asking for the variable to be renamed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

public LoggerProvider(IOptionsMonitor<LoggerOptions> options)
{
optionsReloadToken = options.OnChange(ReConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReConfig isn't a thread-safe method. Perhaps we need to make it thread-safe now?

@natehitze
Copy link
Author

Pulling configuration from DI allows us to use core's configuration system. For instance in dev I use appsettings.json and in production our configuration is stored in environment variables.

See #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants