variables.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from typing import Dict, Any
  2. from ...core.variables import BaseVariables
  3. class ComposeVariables(BaseVariables):
  4. """Compose-specific variable sets declaration.
  5. Each entry in `variable_sets` is now a mapping with a `prompt` to ask
  6. whether the set should be applied and a `variables` mapping containing
  7. the individual variable definitions.
  8. """
  9. variable_sets: Dict[str, Dict[str, Any]] = {
  10. "general": {
  11. "always": True,
  12. "prompt": "Do you want to change the general settings?",
  13. "variables": {
  14. "service_name": {"display_name": "Service name", "default": None, "type": "str", "prompt": "Enter service name"},
  15. "service_port": {
  16. "display_name": "Service port",
  17. "type": "int",
  18. "prompt": "Enter service port(s)",
  19. },
  20. "container_name": {"display_name": "Container name", "default": "", "type": "str", "prompt": "Enter container name"},
  21. "docker_network": {"display_name": "Docker network", "default": "bridge", "type": "str", "prompt": "Enter Docker network name"},
  22. },
  23. },
  24. "swarm": {
  25. "prompt_enable": "Do you want to enable swarm mode?",
  26. "prompt": "Do you want to change the Swarm settings?",
  27. "variables": {
  28. "swarm_replicas": {"display_name": "Number of replicas", "default": 1, "type": "int", "prompt": "Enter number of replicas"},
  29. },
  30. },
  31. "traefik": {
  32. "prompt_enable": "Do you want to add Traefik labels?",
  33. "prompt": "Do you want to change the Traefik labels?",
  34. "variables": {
  35. "traefik_enable": {"display_name": "Enable Traefik", "default": True, "type": "bool", "prompt": "Enable Traefik routing for this service?"},
  36. "traefik_host": {"display_name": "Routing Rule Host", "default": "", "type": "str", "prompt": "Enter hostname for the routing rule (e.g., example.com))"},
  37. "traefik_tls": {"display_name": "Enable TLS", "default": True, "type": "bool", "prompt": "Enable TLS for this router?"},
  38. "traefik_certresolver": {"display_name": "Certificate resolver", "default": "cloudflare", "type": "str", "prompt": "Enter certificate resolver name"},
  39. "traefik_middleware": {"display_name": "Middlewares", "default": "", "type": "str", "prompt": "Enter middlewares (comma-separated, leave empty for none)"},
  40. },
  41. },
  42. }