diff --git a/src/Farmer/Builders/Builders.WebApp.fs b/src/Farmer/Builders/Builders.WebApp.fs index 99957c590..d0673d070 100644 --- a/src/Farmer/Builders/Builders.WebApp.fs +++ b/src/Farmer/Builders/Builders.WebApp.fs @@ -183,8 +183,8 @@ type SlotBuilder() = member this.AddKeyVaultIdentity(state: SlotConfig, identity: UserAssignedIdentityConfig) = this.AddKeyVaultIdentity(state, identity.UserAssignedIdentity) - [] /// Adds an AppSetting to this deployment slot + [] member this.AddSetting(state, key, value) : SlotConfig = { state with AppSettings = state.AppSettings.Add(key, value) @@ -1557,8 +1557,9 @@ module Extensions = /// Sets "Always On" flag [] - 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 [] @@ -1652,8 +1653,8 @@ module Extensions = member this.FTPState(state: 'T, ftpState: FTPState) = this.Map state (fun x -> { x with FTPState = Some ftpState }) - [] /// Specifies the path Azure load balancers will ping to check for unhealthy instances. + [] member this.HealthCheckPath(state: 'T, healthCheckPath: string) = this.Map state (fun x -> { x with diff --git a/src/Tests/WebApp.fs b/src/Tests/WebApp.fs index e7aaedf7a..b0bfe88a1 100644 --- a/src/Tests/WebApp.fs +++ b/src/Tests/WebApp.fs @@ -675,6 +675,7 @@ let tests = Expect.isEmpty wa.SiteConfig.AppSettings "Should be no settings" } + test "Supports always on" { let template = webApp { name "web" @@ -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"