Skip to content

Commit

Permalink
Merge pull request #20 from johnmaguire/config-dir
Browse files Browse the repository at this point in the history
Expand ConfigDir env vars when config.yml is missing
  • Loading branch information
stgraber authored Jan 17, 2024
2 parents 68e8e46 + 89f01eb commit ab231e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,11 @@ func (p *IncusProvider) Configure(ctx context.Context, req provider.ConfigureReq
if configDir == "" {
configDir = "$HOME/.config/incus"
}
configDir = os.ExpandEnv(configDir)

// Try to load config.yml from determined configDir. If there's
// an error loading config.yml, default config will be used.
configPath := os.ExpandEnv(filepath.Join(configDir, "config.yml"))
configPath := filepath.Join(configDir, "config.yml")
config, err := incus_config.LoadConfig(configPath)
if err != nil {
config = incus_config.DefaultConfig()
Expand Down

0 comments on commit ab231e1

Please sign in to comment.