variables.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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": {"display_name": "Service port", "default": None, "type": "int", "prompt": "Enter service port(s)", "description": "Port number(s) the service will expose (has to be a single port)"},
  16. "container_name": {"display_name": "Container name", "default": None, "type": "str", "prompt": "Enter container name"},
  17. "container_hostname": {"display_name": "Container hostname", "default": None, "type": "str", "prompt": "Enter container hostname", "description": "Hostname that will be set inside the container"},
  18. "docker_network": {"display_name": "Docker network", "default": "bridge", "type": "str", "prompt": "Enter Docker network name"},
  19. "restart_policy": {"display_name": "Restart policy", "default": "unless-stopped", "type": "str", "prompt": "Enter restart policy"},
  20. },
  21. },
  22. "swarm": {
  23. "prompt_enable": "Do you want to enable swarm mode?",
  24. "prompt": "Do you want to change the Swarm settings?",
  25. "variables": {
  26. "swarm_replicas": {"display_name": "Number of replicas", "default": 1, "type": "int", "prompt": "Enter number of replicas"},
  27. },
  28. },
  29. "traefik": {
  30. "prompt_enable": "Do you want to add Traefik labels?",
  31. "prompt": "Do you want to change the Traefik labels?",
  32. "variables": {
  33. "traefik_enable": {"display_name": "Enable Traefik", "default": True, "type": "bool", "prompt": "Enable Traefik routing for this service?"},
  34. "traefik_host": {"display_name": "Routing Rule Host", "default": None, "type": "str", "prompt": "Enter hostname for the routing rule (e.g., example.com))", "description": "Domain name that Traefik will use to route traffic to this service"},
  35. "traefik_tls": {"display_name": "Enable TLS", "default": False, "type": "bool", "prompt": "Enable TLS for this router?", "description": "Whether to enable HTTPS/TLS encryption for this route"},
  36. "traefik_certresolver": {"display_name": "Certificate resolver", "type": "str", "prompt": "Enter certificate resolver name", "description": "Name of the certificate resolver to use for obtaining SSL certificates"},
  37. "traefik_middleware": {"display_name": "Middlewares", "default": None, "type": "str", "prompt": "Enter middlewares (comma-separated, leave empty for none)", "description": "Comma-separated list of Traefik middlewares to apply to this route"},
  38. "traefik_entrypoint": {"display_name": "EntryPoint", "default": "web", "type": "str", "prompt": "Enter entrypoint name", "description": "Name of the Traefik entrypoint to use for this router"},
  39. },
  40. },
  41. }