From 9faad41c2e6e997b2e90ccd856d49a6cab28f33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Fri, 2 Aug 2024 10:47:17 +0530 Subject: [PATCH] Add environment variables documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: மனோஜ்குமார் பழனிச்சாமி --- cmd/docker.lima | 4 ++ cmd/kubectl.lima | 4 ++ cmd/lima | 7 +++ cmd/lima.bat | 12 ++-- cmd/limactl/usernet.go | 3 + website/content/en/docs/config/_index.md | 2 + .../en/docs/config/environment-variables.md | 57 +++++++++++++++++++ 7 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 website/content/en/docs/config/environment-variables.md diff --git a/cmd/docker.lima b/cmd/docker.lima index b17ac3bf269..2c2151cd5df 100755 --- a/cmd/docker.lima +++ b/cmd/docker.lima @@ -1,5 +1,9 @@ #!/bin/sh set -eu + +# Environment Variables +# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "docker". + : "${LIMA_INSTANCE:=docker}" : "${DOCKER:=docker}" diff --git a/cmd/kubectl.lima b/cmd/kubectl.lima index 70236ad3ee8..40822e8c973 100755 --- a/cmd/kubectl.lima +++ b/cmd/kubectl.lima @@ -1,5 +1,9 @@ #!/bin/sh set -eu + +# Environment Variables +# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is empty. + : "${LIMA_INSTANCE:=}" : "${KUBECTL:=kubectl}" diff --git a/cmd/lima b/cmd/lima index b78c454594e..f26202c935b 100755 --- a/cmd/lima +++ b/cmd/lima @@ -1,5 +1,12 @@ #!/bin/sh set -eu + +# Environment Variables +# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default". +# LIMA_SHELL: Specifies the shell interpreter to use inside the Lima instance. Default is the user's shell configured inside the instance. +# LIMA_WORKDIR: Specifies the initial working directory inside the Lima instance. Default is the current directory from the host. +# LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in $PATH. + : "${LIMA_INSTANCE:=default}" : "${LIMA_SHELL:=}" : "${LIMA_WORKDIR:=}" diff --git a/cmd/lima.bat b/cmd/lima.bat index c73d453e8e8..d624000d846 100755 --- a/cmd/lima.bat +++ b/cmd/lima.bat @@ -1,4 +1,8 @@ -@echo off -IF NOT DEFINED LIMACTL (SET LIMACTL=limactl) -IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default) -%LIMACTL% shell %LIMA_INSTANCE% %* +@echo off +REM Environment Variables +REM LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default". +REM LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in %PATH%. + +IF NOT DEFINED LIMACTL (SET LIMACTL=limactl) +IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default) +%LIMACTL% shell %LIMA_INSTANCE% %* diff --git a/cmd/limactl/usernet.go b/cmd/limactl/usernet.go index 704c268a65f..5ad356f4464 100644 --- a/cmd/limactl/usernet.go +++ b/cmd/limactl/usernet.go @@ -73,6 +73,9 @@ func usernetAction(cmd *cobra.Command, _ []string) error { os.RemoveAll(qemuSocket) os.RemoveAll(fdSocket) + // Environment Variables + // LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT: Specifies the timeout duration for resolving IP addresses in minutes. Default is 2 minutes. + return usernet.StartGVisorNetstack(cmd.Context(), &usernet.GVisorNetstackOpts{ MTU: mtu, Endpoint: endpoint, diff --git a/website/content/en/docs/config/_index.md b/website/content/en/docs/config/_index.md index bb876ea6e4c..01f831fe57c 100644 --- a/website/content/en/docs/config/_index.md +++ b/website/content/en/docs/config/_index.md @@ -12,3 +12,5 @@ The current default spec: - Disk: 100 GiB - Mounts: `~` (read-only), `/tmp/lima` (writable) - SSH: 127.0.0.1:60022 + +For environment variables, see [Environment Variables](./environment-variables/). diff --git a/website/content/en/docs/config/environment-variables.md b/website/content/en/docs/config/environment-variables.md new file mode 100644 index 00000000000..b8d27213025 --- /dev/null +++ b/website/content/en/docs/config/environment-variables.md @@ -0,0 +1,57 @@ +--- +title: Environment Variables +weight: 6 +--- + +## Environment Variables + +This page documents the environment variables used in Lima. + +### `LIMA_INSTANCE` + +- **Description**: Specifies the name of the Lima instance to use. +- **Default**: `default` +- **Usage**: + ```sh + export LIMA_INSTANCE=my-instance + lima uname -a + ``` + +### `LIMA_SHELL` + +- **Description**: Specifies the shell interpreter to use inside the Lima instance. +- **Default**: User's shell configured inside the instance +- **Usage**: + ```sh + export LIMA_SHELL=/bin/bash + lima + ``` + +### `LIMA_WORKDIR` + +- **Description**: Specifies the initial working directory inside the Lima instance. +- **Default**: Current directory from the host +- **Usage**: + ```sh + export LIMA_WORKDIR=/home/user/project + lima + ``` + +### `LIMACTL` + +- **Description**: Specifies the path to the `limactl` binary. +- **Default**: `limactl` in `$PATH` +- **Usage**: + ```sh + export LIMACTL=/usr/local/bin/limactl + lima + ``` + +### `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT` + +- **Description**: Specifies the timeout duration for resolving the IP address in usernet. +- **Default**: 2 minutes +- **Usage**: + ```sh + export LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT=5 + ```