File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
WebJobs.Script.WebHost/App_Start Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ public static void Main(string[] args)
21
21
rootPath = ( string ) args [ 0 ] ;
22
22
}
23
23
24
- ScriptHostConfiguration config = new ScriptHostConfiguration ( )
24
+ var config = new ScriptHostConfiguration ( )
25
25
{
26
26
RootScriptPath = rootPath
27
27
} ;
28
28
29
- ScriptHostManager scriptHostManager = new ScriptHostManager ( config ) ;
29
+ var scriptHostManager = new ScriptHostManager ( config ) ;
30
30
scriptHostManager . RunAndBlock ( ) ;
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -33,23 +33,24 @@ public class WebHostSettings
33
33
34
34
internal static WebHostSettings CreateDefault ( ScriptSettingsManager settingsManager )
35
35
{
36
- WebHostSettings settings = new WebHostSettings ( ) ;
37
-
38
- string home = settingsManager . GetSetting ( EnvironmentSettingNames . AzureWebsiteHomePath ) ;
39
- bool isLocal = string . IsNullOrEmpty ( home ) ;
40
- if ( isLocal )
36
+ WebHostSettings settings = new WebHostSettings
41
37
{
42
- settings . ScriptPath = settingsManager . GetSetting ( EnvironmentSettingNames . AzureWebJobsScriptRoot ) ;
43
- settings . LogPath = Path . Combine ( Path . GetTempPath ( ) , @"Functions" ) ;
44
- settings . SecretsPath = System . Web . HttpContext . Current . Server . MapPath ( "~/App_Data/Secrets" ) ;
45
- }
46
- else
38
+ IsSelfHost = ! settingsManager . IsAzureEnvironment
39
+ } ;
40
+
41
+ if ( settingsManager . IsAzureEnvironment )
47
42
{
48
- // we're running in Azure
43
+ string home = settingsManager . GetSetting ( EnvironmentSettingNames . AzureWebsiteHomePath ) ;
49
44
settings . ScriptPath = Path . Combine ( home , @"site\wwwroot" ) ;
50
45
settings . LogPath = Path . Combine ( home , @"LogFiles\Application\Functions" ) ;
51
46
settings . SecretsPath = Path . Combine ( home , @"data\Functions\secrets" ) ;
52
47
}
48
+ else
49
+ {
50
+ settings . ScriptPath = settingsManager . GetSetting ( EnvironmentSettingNames . AzureWebJobsScriptRoot ) ;
51
+ settings . LogPath = Path . Combine ( Path . GetTempPath ( ) , @"Functions" ) ;
52
+ settings . SecretsPath = System . Web . HttpContext . Current . Server . MapPath ( "~/App_Data/Secrets" ) ;
53
+ }
53
54
54
55
if ( string . IsNullOrEmpty ( settings . ScriptPath ) )
55
56
{
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public static ScriptSettingsManager Instance
22
22
set { _instance = value ; }
23
23
}
24
24
25
- public bool IsAzureEnvironment => ! string . IsNullOrEmpty ( GetSetting ( EnvironmentSettingNames . AzureWebsiteInstanceId ) ) ;
25
+ public virtual bool IsAzureEnvironment => ! string . IsNullOrEmpty ( GetSetting ( EnvironmentSettingNames . AzureWebsiteInstanceId ) ) ;
26
26
27
27
public bool IsRemoteDebuggingEnabled => ! string . IsNullOrEmpty ( GetSetting ( EnvironmentSettingNames . RemoteDebuggingPort ) ) ;
28
28
You can’t perform that action at this time.
0 commit comments