@@ -24,7 +24,7 @@ public FunctionsHostingConfigOptions()
2424 /// <summary>
2525 /// Gets a value indicating whether worker concurrency feature is enabled in the hosting config.
2626 /// </summary>
27- public bool FunctionsWorkerDynamicConcurrencyEnabled
27+ internal bool FunctionsWorkerDynamicConcurrencyEnabled
2828 {
2929 get
3030 {
@@ -35,7 +35,7 @@ public bool FunctionsWorkerDynamicConcurrencyEnabled
3535 /// <summary>
3636 /// Gets a value indicating whether worker indexing feature is enabled in the hosting config.
3737 /// </summary>
38- public bool WorkerIndexingEnabled
38+ internal bool WorkerIndexingEnabled
3939 {
4040 get
4141 {
@@ -46,11 +46,11 @@ public bool WorkerIndexingEnabled
4646 /// <summary>
4747 /// Gets or Sets a value indicating whether the host should shutdown webhost worker channels during shutdown.
4848 /// </summary>
49- public bool ShutdownWebhostWorkerChannelsOnHostShutdown
49+ internal bool ShutdownWebhostWorkerChannelsOnHostShutdown
5050 {
5151 get
5252 {
53- return GetFeatureOrDefault ( RpcWorkerConstants . ShutdownWebhostWorkerChannelsOnHostShutdown , "1" ) == "1" ;
53+ return GetFeatureAsBooleanOrDefault ( RpcWorkerConstants . ShutdownWebhostWorkerChannelsOnHostShutdown , true ) ;
5454 }
5555
5656 set
@@ -62,11 +62,11 @@ public bool ShutdownWebhostWorkerChannelsOnHostShutdown
6262 /// <summary>
6363 /// Gets or sets a value indicating whether SWT tokens should be accepted.
6464 /// </summary>
65- public bool SwtAuthenticationEnabled
65+ internal bool SwtAuthenticationEnabled
6666 {
6767 get
6868 {
69- return GetFeatureOrDefault ( ScriptConstants . HostingConfigSwtAuthenticationEnabled , "1" ) == "1" ;
69+ return GetFeatureAsBooleanOrDefault ( ScriptConstants . HostingConfigSwtAuthenticationEnabled , true ) ;
7070 }
7171
7272 set
@@ -78,11 +78,11 @@ public bool SwtAuthenticationEnabled
7878 /// <summary>
7979 /// Gets or sets a value indicating whether SWT tokens should be sent on outgoing requests.
8080 /// </summary>
81- public bool SwtIssuerEnabled
81+ internal bool SwtIssuerEnabled
8282 {
8383 get
8484 {
85- return GetFeatureOrDefault ( ScriptConstants . HostingConfigSwtIssuerEnabled , "1" ) == "1" ;
85+ return GetFeatureAsBooleanOrDefault ( ScriptConstants . HostingConfigSwtIssuerEnabled , true ) ;
8686 }
8787
8888 set
@@ -94,7 +94,7 @@ public bool SwtIssuerEnabled
9494 /// <summary>
9595 /// Gets a string delimited by '|' that contains the name of the apps with worker indexing disabled.
9696 /// </summary>
97- public string WorkerIndexingDisabledApps
97+ internal string WorkerIndexingDisabledApps
9898 {
9999 get
100100 {
@@ -105,7 +105,7 @@ public string WorkerIndexingDisabledApps
105105 /// <summary>
106106 /// Gets a value indicating whether Linux Log Backoff is disabled in the hosting config.
107107 /// </summary>
108- public bool DisableLinuxAppServiceLogBackoff
108+ internal bool DisableLinuxAppServiceLogBackoff
109109 {
110110 get
111111 {
@@ -116,7 +116,7 @@ public bool DisableLinuxAppServiceLogBackoff
116116 /// <summary>
117117 /// Gets or sets a value indicating whether Linux AppService/EP Detailed Execution Event is disabled in the hosting config.
118118 /// </summary>
119- public bool DisableLinuxAppServiceExecutionDetails
119+ internal bool DisableLinuxAppServiceExecutionDetails
120120 {
121121 get
122122 {
@@ -129,11 +129,11 @@ public bool DisableLinuxAppServiceExecutionDetails
129129 }
130130 }
131131
132- public bool EnableOrderedInvocationMessages
132+ internal bool EnableOrderedInvocationMessages
133133 {
134134 get
135135 {
136- return GetFeature ( ScriptConstants . FeatureFlagEnableOrderedInvocationmessages ) == "1" ;
136+ return GetFeatureAsBooleanOrDefault ( ScriptConstants . FeatureFlagEnableOrderedInvocationmessages , false ) ;
137137 }
138138
139139 set
@@ -145,7 +145,7 @@ public bool EnableOrderedInvocationMessages
145145 /// <summary>
146146 /// Gets the highest version of extension bundle v3 supported.
147147 /// </summary>
148- public string MaximumBundleV3Version
148+ internal string MaximumBundleV3Version
149149 {
150150 get
151151 {
@@ -156,7 +156,7 @@ public string MaximumBundleV3Version
156156 /// <summary>
157157 /// Gets the highest version of extension bundle v4 supported.
158158 /// </summary>
159- public string MaximumBundleV4Version
159+ internal string MaximumBundleV4Version
160160 {
161161 get
162162 {
@@ -167,15 +167,15 @@ public string MaximumBundleV4Version
167167 /// <summary>
168168 /// Gets a value indicating whether the host should revert the worker shutdown behavior in the WebHostWorkerChannelManager.
169169 /// </summary>
170- public bool RevertWorkerShutdownBehavior
170+ internal bool RevertWorkerShutdownBehavior
171171 {
172172 get
173173 {
174174 return GetFeature ( RpcWorkerConstants . RevertWorkerShutdownBehavior ) == "1" ;
175175 }
176176 }
177177
178- public bool ThrowOnMissingFunctionsWorkerRuntime
178+ internal bool ThrowOnMissingFunctionsWorkerRuntime
179179 {
180180 get
181181 {
@@ -207,5 +207,35 @@ public string GetFeatureOrDefault(string name, string defaultValue)
207207 {
208208 return GetFeature ( name ) ?? defaultValue ;
209209 }
210+
211+ /// <summary>
212+ /// Gets a feature by name and attempts to parse it into a boolean.
213+ /// Returns "True, False" or ints as booleans. Returns True for any non-zero integer.
214+ /// If none of those (or empty), returns default.
215+ /// </summary>
216+ /// <param name="name">Feature name.</param>
217+ /// <param name="defaultValue">The default value to return if the feature value cannot be parsed into a boolean.</param>
218+ /// <returns>Boolean value if parse-able from hosting configuration. Otherwise, the defaultValue.</returns>
219+ internal bool GetFeatureAsBooleanOrDefault ( string name , bool defaultValue )
220+ {
221+ string featureValue = GetFeature ( name ) ;
222+
223+ if ( string . IsNullOrWhiteSpace ( featureValue ) )
224+ {
225+ return defaultValue ;
226+ }
227+
228+ if ( bool . TryParse ( featureValue , out bool parsedBool ) )
229+ {
230+ return parsedBool ;
231+ }
232+
233+ if ( int . TryParse ( featureValue , out int parsedInt ) )
234+ {
235+ return parsedInt != 0 ;
236+ }
237+
238+ return defaultValue ;
239+ }
210240 }
211- }
241+ }
0 commit comments