Skip to content

Commit dc64110

Browse files
authored
Merge pull request #291 from breml/allow-config-dir-env
Allow setting of `config_dir` provider attribute through environment variable
2 parents 2819c33 + ce5dc17 commit dc64110

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ The following arguments are supported:
6161
to. See the `remote` reference below for details.
6262

6363
* `config_dir` - *Optional* - The directory to look for existing Incus
64-
configuration. Defaults to `$HOME/.config/incus`
64+
configuration. This can also be set with the `INCUS_CONF`
65+
Environment variable. Defaults to `$HOME/.config/incus`
6566

6667
* `generate_client_certificates` - *Optional* - Automatically generate the Incus
6768
client certificate if it does not exist. Valid values are `true` and `false`.

internal/provider/provider.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ func (p *IncusProvider) Configure(ctx context.Context, req provider.ConfigureReq
146146
configDir := data.ConfigDir.ValueString()
147147
if configDir == "" {
148148
configDir = "$HOME/.config/incus"
149+
150+
v, ok := os.LookupEnv("INCUS_CONF")
151+
if ok {
152+
configDir = v
153+
}
149154
}
150155
configDir = os.ExpandEnv(configDir)
151156

0 commit comments

Comments
 (0)