Closed leechow007 closed 5 years ago
@leechow007 Simply adding reloadOnChange: true
won't actually update the configuration unless you add the property to the IoC container.
Every configuration file specified gets loaded into IConfigurationRoot
. You can do this in order to see the changes made to the configuration file in runtime.
services.AddSingleton(_ => Configuration);
Does this answer your question?
@leechow007 Simply adding
reloadOnChange: true
won't actually update the configuration unless you add the property to the IoC container.Every configuration file specified gets loaded into
IConfigurationRoot
. You can do this in order to see the changes made to the configuration file in runtime.
services.AddSingleton(_ => Configuration);
Does this answer your question?
Thank u so much!!!
I tried the first method, and its routing rules changed immediately while i manually modifed the ocelot.json file. So I guess maybe it works cause .netcore help me did what you said.
And the later method you mentioned, could you give me more details? I wanna to modify the settings, but it seems like I can only get the settings info and change nothing.
Glad I could help!
This document offers great insight into dependency injection in .netcore and the lifetime of each operation. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2#service-lifetimes
May I close this issue?
Glad I could help!
This document offers great insight into dependency injection in .netcore and the lifetime of each operation. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2#service-lifetimes
May I close this issue?
Thanks a lot. I'll try it.
I plan to use RabbitMQ to receive the message to change gateway config. I need update the config by itself microservice. From what I've seen, There are two ways to reload config on change.
config.AddJsonFile("ocelot.json", optional: false, reloadOnChange: true);
AddAdministration("/administration", options);
but calling itself API is kind of strange. Both two ways doesn't update the config directly, so is there any way to do this simplely? Thank you.