-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
- IdentityServer4, Admin, Admin.Api, STS.Identity, added support for environment-specific configuration files #551
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
Conversation
…environment-specific configuration files in logging setup and CreateHostBuilder(), refs issue skoruba#549
…endings to clean-up PR, refs issue skoruba#549
…8 BOM in modified files to clean-up PR, refs issue skoruba#549
@@ -38,7 +38,9 @@ private static IConfiguration GetConfiguration(string[] args) | |||
var configurationBuilder = new ConfigurationBuilder() | |||
.SetBasePath(Directory.GetCurrentDirectory()) | |||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |||
.AddJsonFile("serilog.json", optional: true, reloadOnChange: true); | |||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this line ? I think apps already works with appsettings{environemnt}.json by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho yes, this line is necessary as there is no "automagic" going on here, see #549 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this line. If anyone wants a custom serilog configuration. The configuration should be mounted into the application.
Define in your release pipeline to mount the serilog.json from the outside to the inside. The proposed line will not work with docker and kubernetes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this line. If anyone wants a custom serilog configuration. The configuration should be mounted into the application.
Define in your release pipeline to mount the serilog.json from the outside to the inside. The proposed line will not work with docker and kubernetes
Thanks for your feedback but i don't understand your instructions. What does "mounted into the application" actually mean and what "release pipeline"? Do you mean i should copy serilog.Development.json
to serilog.json
before releasing the application? And why is the proposed solution not working with docker and kubernetes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you look at the docker compose below
https://github.com/skoruba/IdentityServer4.Admin/blob/master/docker-compose.yml#L35
This give the flexibility for anyone to define serilog.json as they want and mount it from the host machine to the container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it is not necessary but if you want I'd say if you still want to do it. do it in your fork
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want only "necessary" changes not improvements, that's sad as my approach also allows config transformations via SlowCheetah, all effort in vain. Closing the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not the owner of the repo. I just gave a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The owner can very well decide to approve your pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -61,7 +61,9 @@ private static IConfiguration GetConfiguration(string[] args) | |||
var configurationBuilder = new ConfigurationBuilder() | |||
.SetBasePath(Directory.GetCurrentDirectory()) | |||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |||
.AddJsonFile("serilog.json", optional: true, reloadOnChange: true); | |||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this line ? I think apps already works with appsettings{environemnt}.json by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least how I am reading this: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#default-configuration appsettings.json and appsettings.{environment}.json are "magicaly" provided by default. Best regards |
@bo Yes i read this section too but i think its a bit misleading. I've checked the .NET Core sources and as i mentioned in the related issue the Edit I've double checked this again via digging in the sources and by testing it myself with a simple breakpoint, see: In the screenshot you can see that only Hope this helps to understand the issue. |
Hi @ViRuSTriNiTy , indeed, logging configuration is created differently and those lines are needed. Great work. 👍 Thank you |
@skoruba Please unblock the PR when everything is ok. |
PR closed as a result of #551 (comment) |
@ViRuSTriNiTy - please, reopen this PR. I want to use it. |
@skoruba Reopened as requested |
Thanks 👍🏼 |
… in logging setup and
CreateHostBuilder()
, see issue #549