Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(opts ...LoadOption) (bool, error)
Load loads environment variables for an Azure Developer CLI project.
Locates the `.env` file from the default environment name if an Azure Developer CLI project was already provisioned. Returns true if a `.env` file was found and loaded successfully; otherwise, returns an error.
Types ¶
type AzdContext ¶
type AzdContext struct {
// contains filtered or unexported fields
}
AzdContext contains project information for the Azure Development CLI.
func NewAzdContext ¶
func NewAzdContext(opts ...AzdContextOption) (*AzdContext, error)
NewAzdContext constructs a new AzdContext from the given options.
func (*AzdContext) EnvironmentDirectory ¶
func (c *AzdContext) EnvironmentDirectory() string
EnvironmentDirectory gets the path to the .azure directory.
func (*AzdContext) EnvironmentFile ¶
func (c *AzdContext) EnvironmentFile() string
EnvironmentFile gets the path to the .env file under EnvironmentRoot.
func (*AzdContext) EnvironmentName ¶
func (c *AzdContext) EnvironmentName() string
EnvironmentName gets the name of the environment.
func (*AzdContext) EnvironmentRoot ¶
func (c *AzdContext) EnvironmentRoot() string
EnvironmentRoot gets the path to the environment directory under EnvironmentDirectory.
func (*AzdContext) ProjectDirectory ¶
func (c *AzdContext) ProjectDirectory() string
ProjectDirectory gets the directory containing the azure.yaml project file.
func (*AzdContext) ProjectPath ¶
func (c *AzdContext) ProjectPath() string
ProjectPath gets the path to the azure.yaml project file.
type AzdContextOption ¶
type AzdContextOption func(*config) error
AzdContextOption configures options for constructing an AzdContext.
func WithCurrentDirectory ¶
func WithCurrentDirectory(path string) AzdContextOption
WithCurrentDirectory sets a different current directory for NewAzdContext.
func WithEnvironmentName ¶
func WithEnvironmentName(name string) AzdContextOption
WithEnvironmentName sets custom environment name for NewAzdContext.
type LoadOption ¶
type LoadOption func(*loader) error
LoadOption configures options for loading environment variables.
func WithContext ¶
func WithContext(context *AzdContext) LoadOption
WithContext sets the AzdContext to use for discovery.
func WithReplace ¶
func WithReplace(replace bool) LoadOption
WithReplace sets whether to replace environment variables that were already set.