-
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
197e098
- IdentityServer4, Admin, Admin.Api, STS.Identity, added support for …
ViRuSTriNiTy efd9af5
- IdentityServer4, Admin, Admin.Api, STS.Identity, fixed end of line …
ViRuSTriNiTy acd7098
- IdentityServer4, Admin, Admin.Api, STS.Identity, fixed missing UTF-…
ViRuSTriNiTy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
.AddJsonFile("serilog.json", optional: true, reloadOnChange: true) | ||
.AddJsonFile($"serilog.{environment}.json", optional: true, reloadOnChange: true); | ||
|
||
if (isDevelopment) | ||
{ | ||
|
@@ -82,7 +84,13 @@ public static IHostBuilder CreateHostBuilder(string[] args) => | |
configApp.AddJsonFile("identitydata.json", optional: true, reloadOnChange: true); | ||
configApp.AddJsonFile("identityserverdata.json", optional: true, reloadOnChange: true); | ||
|
||
if (hostContext.HostingEnvironment.IsDevelopment()) | ||
var env = hostContext.HostingEnvironment; | ||
|
||
configApp.AddJsonFile($"serilog.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); | ||
configApp.AddJsonFile($"identitydata.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); | ||
configApp.AddJsonFile($"identityserverdata.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); | ||
|
||
if (env.IsDevelopment()) | ||
{ | ||
configApp.AddUserSecrets<Startup>(); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Uh oh!
There was an error while loading. Please reload this page.
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
Uh oh!
There was an error while loading. Please reload this page.
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.
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
toserilog.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.
@skoruba