Skip to content

Commit ca12331

Browse files
ronaldbosmaCopilot
andcommitted
Require host to be 'function' when using language 'logicappsstandard' from azure.logicappsstandard extension
Co-authored-by: Copilot <copilot@github.com>
1 parent 1c9bf20 commit ca12331

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

cli/azd/extensions/azure.logicappsstandard/internal/project/framework_service_logicappsstandard.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ func (p *LogicAppsStandardFrameworkServiceProvider) Initialize(
3434
) error {
3535
p.serviceConfig = serviceConfig
3636

37+
if serviceConfig.Host != "function" {
38+
return fmt.Errorf("Logic Apps Standard requires the host to be 'function', but found '%s'", serviceConfig.Host)
39+
}
40+
3741
if hasCustomCodeProjectConfigured(serviceConfig) {
3842
csProjPath, err := p.resolveCustomCodeProjectPath(serviceConfig)
3943
if err != nil {

cli/azd/extensions/azure.logicappsstandard/internal/project/framework_service_logicappsstandard_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ func TestInitializeValidatesCustomCodeProjectPath(t *testing.T) {
110110
projectDir := t.TempDir()
111111
createFile(t, filepath.Join(projectDir, "azure.yaml"), "name: test-project\n")
112112

113+
t.Run("fails when host is not function", func(t *testing.T) {
114+
provider := &LogicAppsStandardFrameworkServiceProvider{}
115+
svc := newServiceConfig("logicApp", "src/logicApp", nil)
116+
svc.Host = "appservice"
117+
118+
err := provider.Initialize(t.Context(), svc)
119+
require.Error(t, err)
120+
assert.Equal(t, "Logic Apps Standard requires the host to be 'function', but found 'appservice'", err.Error())
121+
})
122+
113123
t.Run("succeeds without customCodeProject and sets serviceConfig", func(t *testing.T) {
114124
provider := &LogicAppsStandardFrameworkServiceProvider{}
115125
svc := newServiceConfig("logicApp", "src/logicApp", nil)
@@ -330,6 +340,7 @@ func newServiceConfig(name, relativePath string, additionalProps map[string]any)
330340
svc := &azdext.ServiceConfig{
331341
Name: name,
332342
RelativePath: relativePath,
343+
Host: "function",
333344
}
334345

335346
if additionalProps != nil {

0 commit comments

Comments
 (0)