From bee0e2ce6314173e7bfab48f6d69c4b964851de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 19 Sep 2023 10:49:51 -0400 Subject: [PATCH] cmd/incus: Add INCUS_PROJECT env variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- cmd/incus/main.go | 2 ++ doc/environment.md | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/incus/main.go b/cmd/incus/main.go index 3097bf3c4fe..5f893eef90d 100644 --- a/cmd/incus/main.go +++ b/cmd/incus/main.go @@ -338,6 +338,8 @@ func (c *cmdGlobal) PreRun(cmd *cobra.Command, args []string) error { // Override the project if c.flagProject != "" { c.conf.ProjectOverride = c.flagProject + } else { + c.conf.ProjectOverride = os.Getenv("INCUS_PROJECT") } // Setup password helper diff --git a/doc/environment.md b/doc/environment.md index 1774ba16206..a6c0a36d5f2 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -23,6 +23,7 @@ Name | Description `INCUS_CONF` | Path to the client configuration directory `INCUS_GLOBAL_CONF` | Path to the global client configuration directory `INCUS_REMOTE` | Name of the remote to use (overrides configured default remote) +`INCUS_PROJECT` | Name of the project to use (overrides configured default project) ## Server environment variable @@ -36,4 +37,4 @@ Name | Description `INCUS_OVMF_PATH` | Path to an OVMF build including `OVMF_CODE.fd` and `OVMF_VARS.ms.fd` `INCUS_SECURITY_APPARMOR` | If set to `false`, forces AppArmor off `INCUS_SHIFTFS_DISABLE` | Disable `shiftfs` support (useful when testing traditional UID shifting) -`INCUS_UI` | Path to the web UI to serve through the web server \ No newline at end of file +`INCUS_UI` | Path to the web UI to serve through the web server