-
Notifications
You must be signed in to change notification settings - Fork 307
Configure ApplicationName of ApplicationEnvironment on WebHostBuilder #625
Conversation
@@ -32,6 +33,8 @@ public WebHostOptions(IConfiguration configuration) | |||
|
|||
public string Application { get; set; } | |||
|
|||
public string EnvironmentApplication { get; set; } |
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.
👎 naming.
874efec
to
10c41ff
Compare
appEnv = new WrappedApplicationEnvironment(_options.ApplicationBasePath, appEnv); | ||
} | ||
var applicationBasePath = ResolvePath(_options.ApplicationBasePath, appEnv.ApplicationBasePath); | ||
var environmentApplicationName = ResolveStartupAssemblyName() ?? appEnv.ApplicationName; |
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 there will ever be a case where we default to appEnv.ApplicationName
since we need to specify a startup assembly/type/method to build the webhost. But I guess keeping the fallback doesn't hurt.
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.
Yeah this would work for us. Is @davidfowl ok with this behavior?
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.
Yep!
🆙📅 |
Better. @pranavkm, is that what you were after? |
@@ -221,12 +221,29 @@ private IServiceCollection BuildHostingServices() | |||
return services; | |||
} | |||
|
|||
private string ResolveStartupAssemblyName() | |||
{ | |||
if (_startup != null) |
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.
Add some comments here
There are some other changes I'd like to see after this change is in. |
Why is travis failing /cc @pranavkm |
52050d5
to
b52bf96
Compare
🆙📅 cc @Tratcher @davidfowl |
if (_startup != null) | ||
{ | ||
var startupAssemblyLocation = Path.GetDirectoryName(_startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.Location); | ||
if (startupAssemblyLocation != null) { |
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.
bad formatting 😄
_startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.Location
This will be null.
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.
It's fine, Path.GetDirectoryName
returns null if the path is null
|
dcd2035
to
b48b5f1
Compare
#613
cc @Tratcher @pranavkm