Computation expression used to configure Saturn application.
Under the hood it's using ASP.NET application configurations interfaces such as IWebHostBuilder
, IServiceCollection
, IApplicationBuilder
and others.
It aims to hide cumbersome ASP.NET application configuration and enable high level, declarative application configuration using feature toggles.
Example:
let app = application {
pipe_through endpointPipe
use_router topRouter
url "http://0.0.0.0:8085/"
memory_cache
use_static "static"
use_gzip
}
Name | Description | |
---|---|---|
Instance Members | ||
x.ActivateDeveloperExceptions(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
use_developer_exceptions
|
Turns on the developer exception page, if the environment is in development mode. |
|
x.AddChannel(state, url, channel)
Signature:
(state:ApplicationState * url:string * channel:IChannel) -> ApplicationState
CE Custom Operation:
add_channel
|
Registers channel for given url. |
|
x.AddMimeTypes(state, mimeList)
Signature:
(state:ApplicationState * mimeList:(string * string) list) -> ApplicationState
CE Custom Operation:
use_mime_types
|
Adds MIME types definitions as a list of (extension, mime) |
|
x.AppConfig(state, config)
Signature:
(state:ApplicationState * config:(IApplicationBuilder -> IApplicationBuilder)) -> ApplicationState
CE Custom Operation:
app_config
|
Adds custom application configuration step. |
|
x.CliArguments(state, args)
Signature:
(state:ApplicationState * args:string array) -> ApplicationState
CE Custom Operation:
cli_arguments
|
Sets the cli arguments for the |
|
x.ConfigJSONSerializer(state, settings)
Signature:
(state:ApplicationState * settings:JsonSerializerSettings) -> ApplicationState
CE Custom Operation:
use_json_settings
|
Configures built in JSON.Net (de)serializer with custom settings. |
|
x.ConfigXMLSerializer(state, settings)
Signature:
(state:ApplicationState * settings:XmlWriterSettings) -> ApplicationState
CE Custom Operation:
use_xml_settings
|
Configures built in XML (de)serializer with custom settings. |
|
x.DisableDiagnostics(state)
Signature:
state:'?39607 -> '?39607
CE Custom Operation:
disable_diagnostics
|
Disables generation of diagnostic files that can be used by Saturn tooling. |
|
x.EndpointRouter(state, routes)
Signature:
(state:ApplicationState * routes:Endpoint list) -> ApplicationState
CE Custom Operation:
use_endpoint_router
|
Defines top-level endpoint router used for the application |
|
x.ErrorHandler(state, handler)
Signature:
(state:ApplicationState * handler:ErrorHandler) -> ApplicationState
CE Custom Operation:
error_handler
|
Adds error/not-found handler for current scope |
|
x.ForceSSL(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
force_ssl
|
Redirect all HTTP request to HTTPS |
|
x.HostConfig(state, config)
Signature:
(state:ApplicationState * config:(IHostBuilder -> IHostBuilder)) -> ApplicationState
CE Custom Operation:
host_config
|
Adds custom generic host ( |
|
x.ListenLocal(state, portNumber, listenOptions)
Signature:
(state:ApplicationState * portNumber:int * listenOptions:(ListenOptions -> unit)) -> ApplicationState
CE Custom Operation:
listen_local
|
Listens on |
|
x.Logging(state, config)
Signature:
(state:ApplicationState * config:(ILoggingBuilder -> unit)) -> ApplicationState
CE Custom Operation:
logging
|
Adds logging configuration. |
|
x.MemoryCache(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
memory_cache
|
Enables in-memory session cache |
|
x.NoRouter(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
no_router
|
Disable warning message about lack of |
|
x.NoWebhost(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
no_webhost
|
Disables any configuration of webhost. Could be used for generic |
|
x.PipeThrough(state, pipe)
Signature:
(state:ApplicationState * pipe:HttpHandler) -> ApplicationState
CE Custom Operation:
pipe_through
|
Adds pipeline to the list of pipelines that will be used for every request |
|
x.Router(state, handler)
Signature:
(state:ApplicationState * handler:HttpHandler) -> ApplicationState
CE Custom Operation:
use_router
|
Defines top-level router used for the application |
|
x.Run(state)
Signature:
state:ApplicationState -> IHostBuilder
|
||
x.ServiceConfig(state, config)
Signature:
(state:ApplicationState * config:(IServiceCollection -> IServiceCollection)) -> ApplicationState
CE Custom Operation:
service_config
|
Adds custom service configuration step. |
|
x.Url(state, url)
Signature:
(state:ApplicationState * url:string) -> ApplicationState
CE Custom Operation:
url
|
Adds url |
|
x.UseAntiforgery(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
use_antiforgery
|
Enables use of the |
|
x.UseAntiforgeryWithConfig(state, configFn)
Signature:
(state:ApplicationState * configFn:(AntiforgeryOptions -> unit)) -> ApplicationState
CE Custom Operation:
use_antiforgery_with_config
|
Enables use of the |
|
x.UseConfig(state, configBuilder)
Signature:
(state:ApplicationState * configBuilder:(IConfiguration -> 'a)) -> ApplicationState
CE Custom Operation:
use_config
|
||
x.UseCookiesAuth(state, issuer)
Signature:
(state:ApplicationState * issuer:string) -> ApplicationState
CE Custom Operation:
use_cookies_authentication
|
Enables default cookies authentication |
|
x.UseCookiesAuthConfig(state, options)
Signature:
(state:ApplicationState * options:(CookieAuthenticationOptions -> unit)) -> ApplicationState
CE Custom Operation:
use_cookies_authentication_with_config
|
Enables cookies authentication with custom configuration |
|
x.UseCors(state, policy, policyConfig)
Signature:
(state:ApplicationState * policy:string * policyConfig:(CorsPolicyBuilder -> unit)) -> ApplicationState
CE Custom Operation:
use_cors
|
Enables application level CORS protection |
|
x.UseCustomJSONSerializer(state, serializer)
Signature:
(state:ApplicationState * serializer:'?39613) -> ApplicationState
CE Custom Operation:
use_json_serializer
|
Replaces built in JSON.Net (de)serializer with custom serializer |
|
x.UseCustomXMLSerializer(state, serializer)
Signature:
(state:ApplicationState * serializer:'?39616) -> ApplicationState
CE Custom Operation:
use_xml_serializer
|
Replaces built in XML (de)serializer with custom serializer |
|
x.UseGZip(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
use_gzip
|
Enables gzip compression |
|
x.UseIIS(state)
Signature:
state:ApplicationState -> ApplicationState
CE Custom Operation:
use_iis
|
Enables IIS integration |
|
x.UseJWTAuth(state, secret, issuer)
Signature:
(state:ApplicationState * secret:string * issuer:string) -> ApplicationState
CE Custom Operation:
use_jwt_authentication
|
Enables default JWT authentication |
|
x.UseJWTAuthConfig(state, config)
Signature:
(state:ApplicationState * config:(JwtBearerOptions -> unit)) -> ApplicationState
CE Custom Operation:
use_jwt_authentication_with_config
|
Enables JWT authentication with custom configuration |
|
x.UseOAuthWithConfig(state, name, config)
Signature:
(state:ApplicationState * name:string * config:(OAuthOptions -> unit)) -> ApplicationState
CE Custom Operation:
use_oauth_with_config
|
Enables OAuth authentication with custom configuration |
|
x.UseOAuthWithSettings(state, clientId, clientSecret, settings)
Signature:
(state:ApplicationState * clientId:string * clientSecret:string * settings:OAuthSettings) -> ApplicationState
CE Custom Operation:
use_oauth
|
Enables simple custom OAuth authentication using parmeters provided with |
|
x.UsePolicy(state, policy, evaluator)
Signature:
(state:ApplicationState * policy:string * evaluator:(AuthorizationHandlerContext -> bool)) -> ApplicationState
CE Custom Operation:
use_policy
|
Add custom policy, taking an |
|
x.UseStatic(state, path)
Signature:
(state:ApplicationState * path:string) -> ApplicationState
CE Custom Operation:
use_static
|
Enables using static file hosting. |
|
x.WebHostConfig(state, config)
Signature:
(state:ApplicationState * config:(IWebHostBuilder -> IWebHostBuilder)) -> ApplicationState
CE Custom Operation:
webhost_config
|
Adds custom web host configuration step. |
|
x.Yield(arg1)
Signature:
'?39576 -> ApplicationState
|