services:
  email-editor:
    build:
      context: .
      args:
        # Override at build time if pointing at staging:
        #   docker compose build --build-arg VITE_HUB_URL=https://staging-msg.gigafibre.ca
        VITE_HUB_URL: https://msg.gigafibre.ca
    container_name: email-editor
    restart: unless-stopped
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      # Public route — same Authentik forwardAuth pattern as ops UI could be
      # added here too, but for now the editor is iframed from the (already
      # authenticated) ops UI so external auth is layered through the parent.
      # Leaving it open means anyone with the URL can edit templates — fine
      # for the iframe-only use case; harden later if exposed standalone.
      - "traefik.http.routers.email-editor.rule=Host(`editor.gigafibre.ca`)"
      - "traefik.http.routers.email-editor.entrypoints=websecure"
      - "traefik.http.routers.email-editor.tls.certresolver=letsencrypt"
      - "traefik.http.services.email-editor.loadbalancer.server.port=80"

networks:
  proxy:
    external: true
