25
25
using Microsoft . Azure . WebJobs . Host ;
26
26
using Microsoft . Azure . WebJobs . Host . Config ;
27
27
using Microsoft . Azure . WebJobs . Extensions . Http ;
28
+ using Azure . Functions . Cli . Interfaces ;
28
29
29
30
namespace Azure . Functions . Cli . Actions . HostActions
30
31
{
@@ -35,6 +36,7 @@ internal class StartHostAction : BaseAction, IDisposable
35
36
const int DefaultPort = 7071 ;
36
37
const TraceLevel DefaultDebugLevel = TraceLevel . Info ;
37
38
const int DefaultTimeout = 20 ;
39
+ private readonly ISecretsManager _secretsManager ;
38
40
39
41
public int Port { get ; set ; }
40
42
@@ -50,12 +52,19 @@ internal class StartHostAction : BaseAction, IDisposable
50
52
51
53
public DebuggerType Debugger { get ; set ; }
52
54
55
+ public StartHostAction ( ISecretsManager secretsManager )
56
+ {
57
+ this . _secretsManager = secretsManager ;
58
+ }
59
+
53
60
public override ICommandLineParserResult ParseArgs ( string [ ] args )
54
61
{
62
+ var hostSettings = _secretsManager . GetHostStartSettings ( ) ;
63
+
55
64
Parser
56
65
. Setup < int > ( 'p' , "port" )
57
66
. WithDescription ( $ "Local port to listen on. Default: { DefaultPort } ")
58
- . SetDefault ( DefaultPort )
67
+ . SetDefault ( hostSettings . LocalHttpPort == default ( int ) ? DefaultPort : hostSettings . LocalHttpPort )
59
68
. Callback ( p => Port = p ) ;
60
69
61
70
Parser
@@ -73,7 +82,7 @@ public override ICommandLineParserResult ParseArgs(string[] args)
73
82
Parser
74
83
. Setup < string > ( "cors" )
75
84
. WithDescription ( $ "A comma separated list of CORS origins with no spaces. Example: https://functions.azure.com,https://functions-staging.azure.com")
76
- . SetDefault ( string . Empty )
85
+ . SetDefault ( hostSettings . Cors ?? string . Empty )
77
86
. Callback ( c => CorsOrigins = c ) ;
78
87
79
88
Parser
0 commit comments