Config file
Add custom appsettings.json like "ELKServerSetting.json" in project.Config:
1 2 3 4 5 6 7 8 9 | { "ELK": { "url": "http://localhost:9200", "indexes": { "userIndex": "user-log", "webApiIndex": "webapi-log" } } } |
Code to read config:
1 2 3 | using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, $"{ConfigurationManager.AppSetting["ELK:url"]}/{ConfigurationManager.AppSetting[documentType]}/documents/")) { } |
No comments:
Post a Comment