Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Support for partial keys #48

Closed
dtkujawski opened this issue Mar 20, 2015 · 1 comment
Closed

Support for partial keys #48

dtkujawski opened this issue Mar 20, 2015 · 1 comment

Comments

@dtkujawski
Copy link
Contributor

Using this framework it is possible to load an entire config file into a object. However, it appears to be all or nothing. I can't, for example, load parts of the configuration into separate objects. For example:

{
   "logging" : {  /*options for logging here*/   }
   "printing" : {  /*options for printing here*/   }
   "otherStuff" : {  /*options for xxx here*/   }
   "moreStuff" : {  /*options for yyy here*/   }
}

I suppose I could just create one container object that has these other objects within it, but might be nice to support loading these partial object directly so the DI's are all separated. Or, I guess I could create multiple log files, but that seems messy as well.

Rationale: I like each framework to be completely independent of the other frameworks (like logging). So, the log framework would get it's log settings independent of the others.

@dtkujawski
Copy link
Contributor Author

Whelp nevermind, looking through some other comments I saw that I can use the GetSubKey method to isolate parts of the configuration file.

services.Configure<LogConfig>(configuration.GetSubKey("logging"));

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

No branches or pull requests

1 participant