-
Notifications
You must be signed in to change notification settings - Fork 170
/
service_config.go
64 lines (58 loc) · 2.44 KB
/
service_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package project
import (
"path/filepath"
"github.com/azure/azure-dev/cli/azd/pkg/apphost"
"github.com/azure/azure-dev/cli/azd/pkg/ext"
"github.com/azure/azure-dev/cli/azd/pkg/infra/provisioning"
"github.com/azure/azure-dev/cli/azd/pkg/osutil"
)
type ServiceConfig struct {
// Reference to the parent project configuration
Project *ProjectConfig `yaml:"-"`
// The friendly name/key of the project from the azure.yaml file
Name string `yaml:"-"`
// The azure resource group to deploy the service to
ResourceGroupName osutil.ExpandableString `yaml:"resourceGroup,omitempty"`
// The name used to override the default azure resource name
ResourceName osutil.ExpandableString `yaml:"resourceName,omitempty"`
// The relative path to the project folder from the project root
RelativePath string `yaml:"project"`
// The azure hosting model to use, ex) appservice, function, containerapp
Host ServiceTargetKind `yaml:"host"`
// The programming language of the project
Language ServiceLanguageKind `yaml:"language"`
// The output path for build artifacts
OutputPath string `yaml:"dist,omitempty"`
// The source image to use for container based applications
Image string `yaml:"image,omitempty"`
// The optional docker options for configuring the output image
Docker DockerProjectOptions `yaml:"docker,omitempty"`
// The optional K8S / AKS options
K8s AksOptions `yaml:"k8s,omitempty"`
// The optional Azure Spring Apps options
Spring SpringOptions `yaml:"spring,omitempty"`
// The infrastructure provisioning configuration
Infra provisioning.Options `yaml:"infra,omitempty"`
// Hook configuration for service
Hooks map[string]*ext.HookConfig `yaml:"hooks,omitempty"`
// Options specific to the DotNetContainerApp target. These are set by the importer and
// can not be controlled via the project file today.
DotNetContainerApp *DotNetContainerAppOptions `yaml:"-,omitempty"`
// Custom configuration for the service target
Config map[string]any `yaml:"config,omitempty"`
*ext.EventDispatcher[ServiceLifecycleEventArgs] `yaml:"-"`
}
type DotNetContainerAppOptions struct {
Manifest *apphost.Manifest
AppHostPath string
ProjectName string
// ContainerImage is non-empty when a prebuilt container image is being used.
ContainerImage string
}
// Path returns the fully qualified path to the project
func (sc *ServiceConfig) Path() string {
if filepath.IsAbs(sc.RelativePath) {
return sc.RelativePath
}
return filepath.Join(sc.Project.Path, sc.RelativePath)
}