Add support for gpu-rent.vars and enhance git update functionality

- Updated .gitignore to include gpu-rent.vars.
- Modified env.example to introduce the UPDATE_GIT variable for controlling git updates during execution.
- Implemented Import-GpuRentVars function in gpu-rent.ps1 to load environment variables from gpu-rent.vars.
- Enhanced gpu-rent.sh to support loading variables from gpu-rent.vars and added logic for handling default and extra arguments.
- Updated CLI documentation to reflect the new gpu-rent.vars file and its usage in configuration.
- Improved bootstrap and provisioning logic to conditionally perform git updates based on the new configuration.
This commit is contained in:
Leonid Pershin
2026-08-21 05:01:53 +03:00
parent ec42830579
commit a9cf2e0f90
23 changed files with 515 additions and 39 deletions
+7
View File
@@ -17,7 +17,9 @@ from gpu_rent.paths import (
migrate_legacy_if_needed,
models_manifest_path,
runtime_dir,
vars_path,
)
from gpu_rent.varsfile import apply_vars_file
def _as_bool(value: str | None, default: bool) -> bool:
@@ -76,6 +78,7 @@ class Config:
swarmui_local_port: int
swarmui_image: str
update_git: bool
default_flavor_id: str
flavor_preference: tuple[str, ...]
@@ -108,6 +111,9 @@ def load_config(*, require_auth: bool = True) -> Config:
if env_file.is_file():
load_dotenv(env_file, override=False)
# Non-secret launch defaults (gpu-rent.vars). Do not override .env / real env.
apply_vars_file(vars_path(), override=False)
missing: list[str] = []
required = (
"OS_AUTH_URL",
@@ -180,6 +186,7 @@ def load_config(*, require_auth: bool = True) -> Config:
autocomplete_filename=(os.environ.get("AUTOCOMPLETE_FILENAME") or "danbooru.csv").strip(),
swarmui_local_port=_as_int(os.environ.get("SWARMUI_LOCAL_PORT"), 17801),
swarmui_image=(os.environ.get("SWARMUI_IMAGE") or "").strip(),
update_git=_as_bool(os.environ.get("UPDATE_GIT"), True),
default_flavor_id=(os.environ.get("DEFAULT_FLAVOR_ID") or "").strip(),
flavor_preference=_csv(
os.environ.get("FLAVOR_PREFERENCE"),