Skip to content
Draft
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions src/Farmer/Builders/Builders.WebApp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ type SlotBuilder() =
member this.AddKeyVaultIdentity(state: SlotConfig, identity: UserAssignedIdentityConfig) =
this.AddKeyVaultIdentity(state, identity.UserAssignedIdentity)

[<CustomOperation "setting">]
/// Adds an AppSetting to this deployment slot
[<CustomOperation "setting">]
member this.AddSetting(state, key, value) : SlotConfig = {
state with
AppSettings = state.AppSettings.Add(key, value)
Expand Down Expand Up @@ -1557,8 +1557,9 @@ module Extensions =

/// Sets "Always On" flag
[<CustomOperation "always_on">]
member this.AlwaysOn(state: 'T) =
{ this.Get state with AlwaysOn = true } |> this.Wrap state
member this.AlwaysOn(state: 'T, ?value: bool) =
let v = defaultArg value true
{ this.Get state with AlwaysOn = v } |> this.Wrap state

///Chooses the bitness (32 or 64) of the worker process
[<CustomOperation "worker_process">]
Expand Down Expand Up @@ -1652,8 +1653,8 @@ module Extensions =
member this.FTPState(state: 'T, ftpState: FTPState) =
this.Map state (fun x -> { x with FTPState = Some ftpState })

[<CustomOperation "health_check_path">]
/// Specifies the path Azure load balancers will ping to check for unhealthy instances.
[<CustomOperation "health_check_path">]
member this.HealthCheckPath(state: 'T, healthCheckPath: string) =
this.Map state (fun x -> {
x with
Expand Down
11 changes: 11 additions & 0 deletions src/Tests/WebApp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ let tests =
Expect.isEmpty wa.SiteConfig.AppSettings "Should be no settings"
}


test "Supports always on" {
let template = webApp {
name "web"
Expand All @@ -687,6 +688,16 @@ let tests =
Expect.equal w.SiteConfig.AlwaysOn (Nullable false) "always on should be false by default"
}

test "Supports conditional always on" {
let expected = false
let template = webApp {
name "web"
always_on expected
}

Expect.equal template.CommonWebConfig.AlwaysOn expected $"AlwaysOn should be {expected}"
}

test "Supports 32 and 64 bit worker processes" {
let site: Site = webApp { name "web" } |> getResourceAtIndex 3
Expect.equal site.SiteConfig.Use32BitWorkerProcess (Nullable()) "Default worker process"
Expand Down
Loading