private static bool TryUpdateConfiguredRuntimeOptions()

in src/Cli/ConfigGenerator.cs [699:775]


        private static bool TryUpdateConfiguredRuntimeOptions(
            ConfigureOptions options,
            [NotNullWhen(true)] ref RuntimeConfig runtimeConfig)
        {
            // Rest: Enabled, Path, and Request.Body.Strict
            if (options.RuntimeRestEnabled != null ||
                options.RuntimeRestPath != null ||
                options.RuntimeRestRequestBodyStrict != null)
            {
                RestRuntimeOptions? updatedRestOptions = runtimeConfig?.Runtime?.Rest ?? new();
                bool status = TryUpdateConfiguredRestValues(options, ref updatedRestOptions);
                if (status)
                {
                    runtimeConfig = runtimeConfig! with { Runtime = runtimeConfig.Runtime! with { Rest = updatedRestOptions } };
                }
                else
                {
                    return false;
                }
            }

            // GraphQL: Enabled, Path, Allow-Introspection and Multiple-Mutations.Create.Enabled
            if (options.RuntimeGraphQLEnabled != null ||
                options.RuntimeGraphQLPath != null ||
                options.RuntimeGraphQLAllowIntrospection != null ||
                options.RuntimeGraphQLMultipleMutationsCreateEnabled != null)
            {
                GraphQLRuntimeOptions? updatedGraphQLOptions = runtimeConfig?.Runtime?.GraphQL ?? new();
                bool status = TryUpdateConfiguredGraphQLValues(options, ref updatedGraphQLOptions);
                if (status)
                {
                    runtimeConfig = runtimeConfig! with { Runtime = runtimeConfig.Runtime! with { GraphQL = updatedGraphQLOptions } };
                }
                else
                {
                    return false;
                }
            }

            // Cache: Enabled and TTL
            if (options.RuntimeCacheEnabled != null ||
                options.RuntimeCacheTTL != null)
            {
                EntityCacheOptions? updatedCacheOptions = runtimeConfig?.Runtime?.Cache ?? new();
                bool status = TryUpdateConfiguredCacheValues(options, ref updatedCacheOptions);
                if (status)
                {
                    runtimeConfig = runtimeConfig! with { Runtime = runtimeConfig.Runtime! with { Cache = updatedCacheOptions } };
                }
                else
                {
                    return false;
                }
            }

            // Host: Mode, Cors.Origins, Cors.AllowCredentials, Authentication.Provider, Authentication.Jwt.Audience, Authentication.Jwt.Issuer
            if (options.RuntimeHostMode != null ||
                options.RuntimeHostCorsOrigins != null ||
                options.RuntimeHostCorsAllowCredentials != null ||
                options.RuntimeHostAuthenticationProvider != null ||
                options.RuntimeHostAuthenticationJwtAudience != null ||
                options.RuntimeHostAuthenticationJwtIssuer != null)
            {
                HostOptions? updatedHostOptions = runtimeConfig?.Runtime?.Host;
                bool status = TryUpdateConfiguredHostValues(options, ref updatedHostOptions);
                if (status)
                {
                    runtimeConfig = runtimeConfig! with { Runtime = runtimeConfig.Runtime! with { Host = updatedHostOptions } };
                }
                else
                {
                    return false;
                }
            }

            return runtimeConfig != null;
        }