INNER CODE UNIT · Go

loadLocalConfig

terraform-lxd/terraform-provider-lxd · internal/acctest/provider_factory.go:187

func loadLocalConfig(configDir string) (*lxdConfig.Config, string, error) {
	// Determine LXD config directory.
	if configDir == "" {
		// Determine LXD configuration directory. First check for the presence
		// of the /var/snap/lxd directory. If the directory exists, return
		// snap's config path. Otherwise return the fallback path.
		_, err := os.Stat("/var/snap/lxd")
		if err == nil || os.IsExist(err) {
			configDir = "$HOME/snap/lxd/common/config"
		} else {
			configDir = "$HOME/.config/lxc"
		}
	}

	configDir = os.ExpandEnv(configDir)
	configPath := filepath.Join(configDir, "config.yml")

	config, err := lxdConfig.LoadConfig(configPath)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…