Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AppInsights only if Deploy = 'azure' on Suave server #81

Merged
merged 1 commit into from
May 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Content/src/Server/ServerSuave.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let config =

let getInitCounter () : Async<Counter> = async { return 42 }

let init : WebPart =
let webApi : WebPart =
#if (Remoting)
let counterProcotol =
{ getInitCounter = getInitCounter }
Expand All @@ -43,15 +43,25 @@ let init : WebPart =
}
#endif

let webPart =
#if (Deploy == "azure")
let webApp =
choose [
init
webApi
Filters.path "/" >=> Files.browseFileHome "index.html"
Files.browseHome
RequestErrors.NOT_FOUND "Not found!"
] |> Azure.AI.withAppInsights Azure.AI.buildApiOperationName

Azure.AppServices.addTraceListeners()
Azure.AI.configure { AppInsightsKey = appInsightsKey; DeveloperMode = false; TrackDependencies = true }
#else
let webApp =
choose [
webApi
Filters.path "/" >=> Files.browseFileHome "index.html"
Files.browseHome
RequestErrors.NOT_FOUND "Not found!"
]
#endif

startWebServer config webPart
startWebServer config webApp