Skip to content

Commit 16f9649

Browse files
Add flag to disable site map generation
1 parent 4b11b55 commit 16f9649

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Saturn/Application.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,16 @@ module Application =
366366
ServicesConfig = service::state.ServicesConfig
367367
}
368368

369+
///Disables generation of diagnostic files that can be used by Saturn tooling.
370+
[<CustomOperation("disable_diagnostics")>]
371+
member __.DisableDiagnostics (state) =
372+
SiteMap.isDebug <- false
373+
state
374+
369375
///Computation expression used to configure Saturn application
370376
let application = ApplicationBuilder()
371377

372378
///Runs Saturn application
373379
let run (app: IWebHostBuilder) =
374-
SiteMap.generate ()
380+
if SiteMap.isDebug then SiteMap.generate ()
375381
app.Build().Run()

src/Saturn/Diagnostics.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Saturn
22
open System.IO
33

44
module SiteMap =
5-
let mutable private isDebug = true //Somehow detect if Saturn is used by application compiled in debug or release
5+
let mutable internal isDebug = true //Somehow detect if Saturn is used by application compiled in debug or release
66

77
type internal PathRegistrationEvent =
88
| Path of path: string * verb: string

0 commit comments

Comments
 (0)