You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add MISTRAL_ environment variable support with precedence over KOYEB_
- Add helper functions (get_api_token, get_api_host, get_region) in utils.py
- Update get_api_clients() and get_async_api_clients() to check MISTRAL_ vars first
- Update sandbox.py and snapshot.py to use the new helper functions
- Update documentation and examples to mention both MISTRAL_ and KOYEB_ env vars
- MISTRAL_API_TOKEN, MISTRAL_API_HOST, and MISTRAL_REGION take precedence over KOYEB_ counterparts
This allows users to use either MISTRAL_ or KOYEB_ environment variables, with
MISTRAL_ variables taking precedence when both are set.
Co-authored-by: nicoche <nicoche@users.noreply.github.com>
-`region`- Region to deploy to. Defaults to KOYEB_REGION env var, or"na"ifnotset.
1097
-
-`api_token`- Koyeb API token (ifNone, will try to get fromKOYEB_API_TOKEN env var)
1096
+
-`region`- Region to deploy to. Defaults to MISTRAL_REGIONorMISTRAL_REGIONorKOYEB_REGION env var, or"na"ifnotset.
1097
+
-`api_token`- Koyeb API token (ifNone, will try to get fromMISTRAL_API_TOKENorMISTRAL_API_TOKENorKOYEB_API_TOKEN env var)
1098
1098
-`timeout`- Timeout for sandbox creation in seconds
1099
1099
-`idle_timeout`- Sleep timeout in seconds. Behavior depends on _experimental_enable_light_sleep:
1100
1100
- If _experimental_enable_light_sleep isTrue: sets light_sleep value (deep_sleep=3900)
@@ -1116,7 +1116,7 @@ Create a new sandbox instance.
1116
1116
-`poll_interval`- Time between health checks in seconds when wait_ready isTrue (default: 0.5)
1117
1117
-`entrypoint`- Override the default entrypoint of the Docker image (e.g., ["/bin/sh", "-c"])
1118
1118
-`command`- Override the default command of the Docker image (e.g., "python app.py")
1119
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1119
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorMISTRAL_API_HOSTorKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1120
1120
-`block_network`- If True, block all outbound network access from the sandbox
1121
1121
-`outbound_allowlist`- List of IPs/CIDRs allowed as outbound destinations;
1122
1122
all other outbound traffic is blocked. Bare IPs are normalized to
@@ -1164,8 +1164,8 @@ Get a sandbox by service ID.
1164
1164
**Arguments**:
1165
1165
1166
1166
-`id`- Service ID of the sandbox
1167
-
-`api_token`- Koyeb API token (ifNone, will try to get fromKOYEB_API_TOKEN env var)
1168
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1167
+
-`api_token`- Koyeb API token (ifNone, will try to get fromMISTRAL_API_TOKENorMISTRAL_API_TOKENorKOYEB_API_TOKEN env var)
1168
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorMISTRAL_API_HOSTorKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1169
1169
1170
1170
1171
1171
**Returns**:
@@ -1623,8 +1623,8 @@ Get a sandbox by service ID asynchronously.
1623
1623
**Arguments**:
1624
1624
1625
1625
-`id`- Service ID of the sandbox
1626
-
-`api_token`- Koyeb API token (ifNone, will try to get fromKOYEB_API_TOKEN env var)
1627
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1626
+
-`api_token`- Koyeb API token (ifNone, will try to get fromMISTRAL_API_TOKENorMISTRAL_API_TOKENorKOYEB_API_TOKEN env var)
1627
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorMISTRAL_API_HOSTorKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1628
1628
1629
1629
1630
1630
**Returns**:
@@ -1690,8 +1690,8 @@ Create a new sandbox instance with async support.
1690
1690
file paths to file contents. Values can be plain strings (default permissions 0644)
-`region`- Region to deploy to. Defaults to KOYEB_REGION env var, or"na"ifnotset.
1694
-
-`api_token`- Koyeb API token (ifNone, will try to get fromKOYEB_API_TOKEN env var)
1693
+
-`region`- Region to deploy to. Defaults to MISTRAL_REGIONorMISTRAL_REGIONorKOYEB_REGION env var, or"na"ifnotset.
1694
+
-`api_token`- Koyeb API token (ifNone, will try to get fromMISTRAL_API_TOKENorMISTRAL_API_TOKENorKOYEB_API_TOKEN env var)
1695
1695
-`timeout`- Timeout for sandbox creation in seconds
1696
1696
-`idle_timeout`- Sleep timeout in seconds. Behavior depends on _experimental_enable_light_sleep:
1697
1697
- If _experimental_enable_light_sleep isTrue: sets light_sleep value (deep_sleep uses _experimental_deep_sleep_value)
@@ -1715,7 +1715,7 @@ Create a new sandbox instance with async support.
1715
1715
-`poll_interval`- Time between health checks in seconds when wait_ready isTrue (default: 0.5)
1716
1716
-`entrypoint`- Override the default entrypoint of the Docker image (e.g., ["/bin/sh", "-c"])
1717
1717
-`command`- Override the default command of the Docker image (e.g., "python app.py")
1718
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1718
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorMISTRAL_API_HOSTorKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
1719
1719
-`block_network`- If True, block all outbound network access from the sandbox
1720
1720
-`outbound_allowlist`- List of IPs/CIDRs allowed as outbound destinations;
1721
1721
all other outbound traffic is blocked. Bare IPs are normalized to
@@ -2001,8 +2001,8 @@ Caches clients by (token, host) to reuse the underlying HTTP connection pool.
2001
2001
2002
2002
**Arguments**:
2003
2003
2004
-
-`api_token`- Koyeb API token. If not provided, will try to get fromKOYEB_API_TOKEN env var
2005
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
2004
+
-`api_token`- Koyeb API token. If not provided, will try to get fromMISTRAL_API_TOKENorMISTRAL_API_TOKENorKOYEB_API_TOKEN env var
2005
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorMISTRAL_API_HOSTorKOYEB_API_HOST env var (defaults to https://app.koyeb.com)
2006
2006
2007
2007
2008
2008
**Returns**:
@@ -2040,8 +2040,8 @@ Caches clients by (token, host) to reuse the underlying HTTP connection pool.
2040
2040
2041
2041
**Arguments**:
2042
2042
2043
-
-`api_token`- Koyeb API token. If not provided, will try to get fromKOYEB_API_TOKEN env var
2044
-
-`host`- Koyeb API host URL. If not provided, will try to get fromKOYEB_API_HOST env var
2043
+
-`api_token`- Koyeb API token. If not provided, will try to get fromMISTRAL_API_TOKENorKOYEB_API_TOKEN env var
2044
+
-`host`- Koyeb API host URL. If not provided, will try to get fromMISTRAL_API_HOSTorKOYEB_API_HOST env var
2045
2045
2046
2046
2047
2047
**Returns**:
@@ -2220,7 +2220,7 @@ Create deployment definition for a sandbox service.
2220
2220
-`exposed_port_protocol`- Protocol to expose ports with ("http"or"http2").
2221
2221
If None, defaults to "http".
2222
2222
If provided, must be one of "http"or"http2".
2223
-
-`region`- Region to deploy to. Defaults to KOYEB_REGION env var, or"na"ifnotset.
2223
+
-`region`- Region to deploy to. Defaults to MISTRAL_REGIONorMISTRAL_REGIONorKOYEB_REGION env var, or"na"ifnotset.
2224
2224
-`routes`- List of routes for public access
2225
2225
-`idle_timeout`- Number of seconds to wait before sleeping the instance if it receives no traffic
2226
2226
-`enable_tcp_proxy`- If True, enables TCP proxy for direct TCP access to port 3031
0 commit comments