Skip to content

Commit f6aa9e3

Browse files
authored
Introduce new ApplicationHostOptions model for serialization (#9930)
1 parent 485d383 commit f6aa9e3

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

src/WebJobs.Script.WebHost/Controllers/HostController.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,21 @@ public async Task<IActionResult> SyncTriggers()
402402
public IActionResult Restart([FromServices] IScriptHostManager hostManager)
403403
{
404404
Task ignore = hostManager.RestartHostAsync();
405-
return Ok(_applicationHostOptions.Value);
405+
406+
var hostOptionsValue = _applicationHostOptions.Value;
407+
var response = new HostRestartResponse()
408+
{
409+
IsFileSystemReadOnly = hostOptionsValue.IsFileSystemReadOnly,
410+
IsScmRunFromPackage = hostOptionsValue.IsScmRunFromPackage,
411+
IsSelfHost = hostOptionsValue.IsSelfHost,
412+
HasParentScope = hostOptionsValue.HasParentScope,
413+
LogPath = hostOptionsValue.LogPath,
414+
ScriptPath = hostOptionsValue.ScriptPath,
415+
SecretsPath = hostOptionsValue.SecretsPath,
416+
TestDataPath = hostOptionsValue.TestDataPath
417+
};
418+
419+
return Ok(response);
406420
}
407421

408422
/// <summary>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System;
5+
6+
/// <summary>
7+
/// The model used for the response message in 'admin/host/restart' API endpoint.
8+
/// This contains all the properties from <see cref="ScriptApplicationHostOptions"/> excluding the <see cref="IServiceProvider"/> property.
9+
/// </summary>
10+
namespace Microsoft.Azure.WebJobs.Script.WebHost.Models
11+
{
12+
public class HostRestartResponse
13+
{
14+
public bool IsSelfHost { get; set; }
15+
16+
public string SecretsPath { get; set; }
17+
18+
public string ScriptPath { get; set; }
19+
20+
public string LogPath { get; set; }
21+
22+
public string TestDataPath { get; set; }
23+
24+
public bool HasParentScope { get; set; }
25+
26+
public bool IsStandbyConfiguration { get; set; }
27+
28+
public bool IsFileSystemReadOnly { get; set; }
29+
30+
public bool IsScmRunFromPackage { get; set; }
31+
}
32+
}

0 commit comments

Comments
 (0)