@@ -21,6 +21,8 @@ namespace Microsoft.Azure.WebJobs.Script
21
21
public class ScriptHost : JobHost
22
22
{
23
23
private const string HostAssemblyName = "ScriptHost" ;
24
+ private const string HostFileName = "host.json" ;
25
+ internal const string FunctionConfigFileName = "function.json" ;
24
26
private readonly TraceWriter _traceWriter ;
25
27
private readonly AutoResetEvent _restartEvent = new AutoResetEvent ( false ) ;
26
28
private Action < FileSystemEventArgs > _restart ;
@@ -123,7 +125,7 @@ protected virtual void Initialize()
123
125
}
124
126
125
127
// read host.json and apply to JobHostConfiguration
126
- string hostConfigFilePath = Path . Combine ( ScriptConfig . RootScriptPath , "host.json" ) ;
128
+ string hostConfigFilePath = Path . Combine ( ScriptConfig . RootScriptPath , HostFileName ) ;
127
129
_traceWriter . Verbose ( string . Format ( "Reading host configuration file '{0}'" , hostConfigFilePath ) ) ;
128
130
string json = File . ReadAllText ( hostConfigFilePath ) ;
129
131
JObject hostConfig = JObject . Parse ( json ) ;
@@ -268,7 +270,7 @@ internal static Collection<FunctionDescriptor> ReadFunctions(ScriptHostConfigura
268
270
foreach ( var scriptDir in Directory . EnumerateDirectories ( scriptRootPath ) )
269
271
{
270
272
// read the function config
271
- string functionConfigPath = Path . Combine ( scriptDir , "function.json" ) ;
273
+ string functionConfigPath = Path . Combine ( scriptDir , FunctionConfigFileName ) ;
272
274
if ( ! File . Exists ( functionConfigPath ) )
273
275
{
274
276
// not a function directory
@@ -294,7 +296,7 @@ internal static Collection<FunctionDescriptor> ReadFunctions(ScriptHostConfigura
294
296
}
295
297
296
298
// determine the primary script
297
- string [ ] functionFiles = Directory . EnumerateFiles ( scriptDir ) . Where ( p => Path . GetFileName ( p ) . ToLowerInvariant ( ) != "function.json" ) . ToArray ( ) ;
299
+ string [ ] functionFiles = Directory . EnumerateFiles ( scriptDir ) . Where ( p => Path . GetFileName ( p ) . ToLowerInvariant ( ) != FunctionConfigFileName ) . ToArray ( ) ;
298
300
if ( functionFiles . Length == 0 )
299
301
{
300
302
continue ;
@@ -463,7 +465,7 @@ private void OnFileChanged(object sender, FileSystemEventArgs e)
463
465
{
464
466
string fileName = Path . GetFileName ( e . Name ) ;
465
467
466
- if ( ( ( string . Compare ( fileName , "host.json" ) == 0 ) || string . Compare ( fileName , "function.json" ) == 0 ) ||
468
+ if ( ( ( string . Compare ( fileName , HostFileName , ignoreCase : true ) == 0 ) || string . Compare ( fileName , FunctionConfigFileName , ignoreCase : true ) == 0 ) ||
467
469
( ( Directory . EnumerateDirectories ( ScriptConfig . RootScriptPath ) . Count ( ) != _directoryCountSnapshot ) ) )
468
470
{
469
471
// a host level configuration change has been made which requires a
0 commit comments