@@ -56,6 +56,13 @@ public void Configure(ScriptJobHostOptions options)
56
56
// Worker configuration
57
57
ConfigureLanguageWorkers ( jobHostSection , options ) ;
58
58
59
+ // If we have a read only file system, override any configuration and
60
+ // disable file watching
61
+ if ( _environment . FileSystemIsReadOnly ( ) )
62
+ {
63
+ options . FileWatchingEnabled = false ;
64
+ }
65
+
59
66
// Set the root script path to the value the runtime was initialized with:
60
67
ScriptApplicationHostOptions webHostOptions = _applicationHostOptions . Value ;
61
68
options . RootScriptPath = webHostOptions . ScriptPath ;
@@ -135,129 +142,5 @@ private void ConfigureLanguageWorkers(IConfigurationSection rootConfig, ScriptJo
135
142
}
136
143
scriptOptions . MaxMessageLengthBytes = requestedGrpcMaxMessageLength ;
137
144
}
138
-
139
- // TODO: DI (FACAVAL) Moved this from ScriptHost. Validate we're applying all configuration
140
- // Also noticed a lot of discrepancy between the original logic and the documentation and schema. We need to address
141
- // that. The current implemenation will match the original, which means that schema and docs will need to be udpated.
142
- //internal static void ApplyConfiguration(JObject config, ScriptHostConfiguration scriptConfig, ILogger logger = null)
143
- //{
144
- // var hostConfig = scriptConfig.HostOptions;
145
-
146
- // hostConfig.HostConfigMetadata = config;
147
-
148
- // JArray functions = (JArray)config["functions"];
149
- // if (functions != null && functions.Count > 0)
150
- // {
151
- // scriptConfig.Functions = new Collection<string>();
152
- // foreach (var function in functions)
153
- // {
154
- // scriptConfig.Functions.Add((string)function);
155
- // }
156
- // }
157
- // else
158
- // {
159
- // scriptConfig.Functions = null;
160
- // }
161
-
162
- // // We may already have a host id, but the one from the JSON takes precedence
163
- // JToken hostId = (JToken)config["id"];
164
- // if (hostId != null)
165
- // {
166
- // hostConfig.HostId = (string)hostId;
167
- // }
168
-
169
- // // Default AllowHostPartialStartup to true, but allow it
170
- // // to be overridden by config
171
- // hostConfig.AllowPartialHostStartup = true;
172
- // JToken allowPartialHostStartup = (JToken)config["allowPartialHostStartup"];
173
- // if (allowPartialHostStartup != null && allowPartialHostStartup.Type == JTokenType.Boolean)
174
- // {
175
- // hostConfig.AllowPartialHostStartup = (bool)allowPartialHostStartup;
176
- // }
177
-
178
- // JToken fileWatchingEnabled = (JToken)config["fileWatchingEnabled"];
179
- // if (fileWatchingEnabled != null && fileWatchingEnabled.Type == JTokenType.Boolean)
180
- // {
181
- // scriptConfig.FileWatchingEnabled = (bool)fileWatchingEnabled;
182
- // }
183
-
184
- // // Configure the set of watched directories, adding the standard built in
185
- // // set to any the user may have specified
186
- // if (scriptConfig.WatchDirectories == null)
187
- // {
188
- // scriptConfig.WatchDirectories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
189
- // }
190
- // scriptConfig.WatchDirectories.Add("node_modules");
191
- // JToken watchDirectories = config["watchDirectories"];
192
- // if (watchDirectories != null && watchDirectories.Type == JTokenType.Array)
193
- // {
194
- // foreach (JToken directory in watchDirectories.Where(p => p.Type == JTokenType.String))
195
- // {
196
- // scriptConfig.WatchDirectories.Add((string)directory);
197
- // }
198
- // }
199
-
200
- // JToken nugetFallbackFolder = config["nugetFallbackFolder"];
201
- // if (nugetFallbackFolder != null && nugetFallbackFolder.Type == JTokenType.String)
202
- // {
203
- // scriptConfig.NugetFallBackPath = (string)nugetFallbackFolder;
204
- // }
205
-
206
- // // Apply Singleton configuration
207
- // JObject configSection = (JObject)config["singleton"];
208
- // JToken value = null;
209
- // if (configSection != null)
210
- // {
211
- // if (configSection.TryGetValue("lockPeriod", out value))
212
- // {
213
- // hostConfig.Singleton.LockPeriod = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
214
- // }
215
- // if (configSection.TryGetValue("listenerLockPeriod", out value))
216
- // {
217
- // hostConfig.Singleton.ListenerLockPeriod = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
218
- // }
219
- // if (configSection.TryGetValue("listenerLockRecoveryPollingInterval", out value))
220
- // {
221
- // hostConfig.Singleton.ListenerLockRecoveryPollingInterval = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
222
- // }
223
- // if (configSection.TryGetValue("lockAcquisitionTimeout", out value))
224
- // {
225
- // hostConfig.Singleton.LockAcquisitionTimeout = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
226
- // }
227
- // if (configSection.TryGetValue("lockAcquisitionPollingInterval", out value))
228
- // {
229
- // hostConfig.Singleton.LockAcquisitionPollingInterval = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
230
- // }
231
- // }
232
-
233
- // // Apply Host Health Montitor configuration
234
- // configSection = (JObject)config["healthMonitor"];
235
- // value = null;
236
- // if (configSection != null)
237
- // {
238
- // if (configSection.TryGetValue("enabled", out value) && value.Type == JTokenType.Boolean)
239
- // {
240
- // scriptConfig.HostHealthMonitor.Enabled = (bool)value;
241
- // }
242
- // if (configSection.TryGetValue("healthCheckInterval", out value))
243
- // {
244
- // scriptConfig.HostHealthMonitor.HealthCheckInterval = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
245
- // }
246
- // if (configSection.TryGetValue("healthCheckWindow", out value))
247
- // {
248
- // scriptConfig.HostHealthMonitor.HealthCheckWindow = TimeSpan.Parse((string)value, CultureInfo.InvariantCulture);
249
- // }
250
- // if (configSection.TryGetValue("healthCheckThreshold", out value))
251
- // {
252
- // scriptConfig.HostHealthMonitor.HealthCheckThreshold = (int)value;
253
- // }
254
- // if (configSection.TryGetValue("counterThreshold", out value))
255
- // {
256
- // scriptConfig.HostHealthMonitor.CounterThreshold = (float)value;
257
- // }
258
- // }
259
-
260
- // ApplyLanguageWorkersConfig(config, scriptConfig, logger);
261
- //}
262
145
}
263
146
}
0 commit comments