Skip to content

tsops@1.5.0

Choose a tag to compare

@github-actions github-actions released this 06 Nov 13:12
· 74 commits to main since this release
2907ad7

Minor Changes

  • Breaking Changes

    Simplified Ingress Definition

    The ingress definition now only accepts an object format or a function returning an object. String and boolean formats have been removed for better type safety and explicit protocol control.

    Before:

    ingress: "example.com"; // ❌ No longer supported
    ingress: true; // ❌ No longer supported

    After:

    ingress: ({ domain }) => ({ domain: `api.${domain}` });
    // With explicit protocol:
    ingress: ({ domain }) => ({
      domain: `api.${domain}`,
      protocol: "https", // optional, auto-detected by default
    });

    Protocol Auto-Detection

    Ingress protocol is now automatically detected based on the domain:

    • Local domains (*.localtest.me, localhost, *.local) → http
    • Production domains → https
    • Can be explicitly overridden via protocol option

    Features

    Service Discovery Documentation

    Added comprehensive documentation and examples for proper service-to-service communication using runtime config helpers:

    // ✅ Correct: Use runtime config
    import config from "./tsops.config";
    
    const apiUrl = config.url("api", "service"); // http://api
    const apiUrl = config.url("api", "cluster"); // http://api.prod.svc.cluster.local
    const publicUrl = config.url("api", "ingress"); // https://api.example.com

    Benefits:

    • Type-safe with compile-time checking
    • Respects TSOPS_NAMESPACE environment variable
    • Single source of truth
    • No container restarts needed for endpoint changes

    Platform-Agnostic Documentation

    All documentation has been updated to be platform-agnostic, removing specific references to Kubernetes to prepare for future multi-platform support.

    Migration Guide

    Update Ingress Definitions

    Change all ingress definitions to use object format:

    // Before
    apps: {
      api: {
        ingress: "api.example.com"; // ❌
      }
    }
    
    // After
    apps: {
      api: {
        ingress: ({ domain }) => ({ domain: `api.${domain}` }); // ✅
      }
    }

    Use Runtime Config for Service Discovery

    Replace hardcoded DNS or ENV variables with runtime config:

    // ❌ Before: Hardcoded in ENV
    env: () => ({
      BACKEND_URL: "http://backend:3000", // Anti-pattern!
    });
    
    // ✅ After: In your application code
    import config from "./tsops.config";
    const backendUrl = config.url("backend", "service");

    ENV Variables Are Only For

    Use ENV variables only for:

    • Secrets (API keys, passwords, tokens)
    • External services (outside the cluster)
    • Feature flags and configuration
    • Build-time values

    Never use ENV for internal service URLs - use config.url() in runtime instead.

Patch Changes

  • Updated dependencies []:
    • @tsops/core@0.6.0
    • @tsops/node@0.2.4