@@ -21,6 +21,8 @@ namespace Microsoft.Azure.WebJobs.Script
2121 public class ScriptHost : JobHost
2222 {
2323 private const string HostAssemblyName = "ScriptHost" ;
24+ private const string HostFileName = "host.json" ;
25+ internal const string FunctionConfigFileName = "function.json" ;
2426 private readonly TraceWriter _traceWriter ;
2527 private readonly AutoResetEvent _restartEvent = new AutoResetEvent ( false ) ;
2628 private Action < FileSystemEventArgs > _restart ;
@@ -123,7 +125,7 @@ protected virtual void Initialize()
123125 }
124126
125127 // read host.json and apply to JobHostConfiguration
126- string hostConfigFilePath = Path . Combine ( ScriptConfig . RootScriptPath , "host.json" ) ;
128+ string hostConfigFilePath = Path . Combine ( ScriptConfig . RootScriptPath , HostFileName ) ;
127129 _traceWriter . Verbose ( string . Format ( "Reading host configuration file '{0}'" , hostConfigFilePath ) ) ;
128130 string json = File . ReadAllText ( hostConfigFilePath ) ;
129131 JObject hostConfig = JObject . Parse ( json ) ;
@@ -268,7 +270,7 @@ internal static Collection<FunctionDescriptor> ReadFunctions(ScriptHostConfigura
268270 foreach ( var scriptDir in Directory . EnumerateDirectories ( scriptRootPath ) )
269271 {
270272 // read the function config
271- string functionConfigPath = Path . Combine ( scriptDir , "function.json" ) ;
273+ string functionConfigPath = Path . Combine ( scriptDir , FunctionConfigFileName ) ;
272274 if ( ! File . Exists ( functionConfigPath ) )
273275 {
274276 // not a function directory
@@ -294,7 +296,7 @@ internal static Collection<FunctionDescriptor> ReadFunctions(ScriptHostConfigura
294296 }
295297
296298 // 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 ( ) ;
298300 if ( functionFiles . Length == 0 )
299301 {
300302 continue ;
@@ -463,7 +465,7 @@ private void OnFileChanged(object sender, FileSystemEventArgs e)
463465 {
464466 string fileName = Path . GetFileName ( e . Name ) ;
465467
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 ) ||
467469 ( ( Directory . EnumerateDirectories ( ScriptConfig . RootScriptPath ) . Count ( ) != _directoryCountSnapshot ) ) )
468470 {
469471 // a host level configuration change has been made which requires a
0 commit comments