@crossdelta/infrastructure 0.2.27 → 0.3.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,62 +0,0 @@
1
- import type * as pulumi from '@pulumi/pulumi';
2
- /**
3
- * OpenTelemetry configuration for OTLP export.
4
- */
5
- export interface OtelConfig {
6
- /** OTLP endpoint for traces (e.g., https://in-otel.logs.betterstack.com/v1/traces) */
7
- tracesEndpoint?: pulumi.Input<string>;
8
- /** OTLP endpoint for metrics (e.g., https://in-otel.logs.betterstack.com/v1/metrics) */
9
- metricsEndpoint?: pulumi.Input<string>;
10
- /** OTLP headers (e.g., "Authorization=Bearer xxx") */
11
- headers?: pulumi.Input<string>;
12
- /** Deployment environment (e.g., "production", "staging") */
13
- environment?: string;
14
- }
15
- /**
16
- * Builds OpenTelemetry environment variables for a service.
17
- *
18
- * @param serviceName - Unique service name (e.g., "orderboss-storefront")
19
- * @param config - OTel configuration from Pulumi config
20
- * @returns Record of environment variables for OTel SDK auto-instrumentation
21
- *
22
- * @example
23
- * ```typescript
24
- * const otelConfig = {
25
- * tracesEndpoint: cfg.get('otelTracesEndpoint'),
26
- * metricsEndpoint: cfg.get('otelMetricsEndpoint'),
27
- * headers: cfg.getSecret('otelHeaders'),
28
- * environment: 'production',
29
- * }
30
- *
31
- * const serviceConfig = {
32
- * name: 'orders',
33
- * env: {
34
- * ...buildOtelEnv('orderboss-orders', otelConfig),
35
- * // other env vars
36
- * },
37
- * }
38
- * ```
39
- */
40
- export declare function buildOtelEnv(serviceName: string, config: OtelConfig): Record<string, pulumi.Input<string>>;
41
- /**
42
- * Creates a function that builds OTel env vars with pre-configured endpoints.
43
- * Useful for applying the same OTel config to multiple services.
44
- *
45
- * @param config - OTel configuration from Pulumi config
46
- * @returns Function that takes a service name and returns OTel env vars
47
- *
48
- * @example
49
- * ```typescript
50
- * const withOtelEnv = createOtelEnvBuilder({
51
- * tracesEndpoint: cfg.get('otelTracesEndpoint'),
52
- * headers: cfg.getSecret('otelHeaders'),
53
- * environment: getStack(),
54
- * })
55
- *
56
- * // In each service config:
57
- * env: {
58
- * ...withOtelEnv('orderboss-orders'),
59
- * }
60
- * ```
61
- */
62
- export declare function createOtelEnvBuilder(config: OtelConfig): (serviceName: string) => Record<string, pulumi.Input<string>>;
@@ -1,39 +0,0 @@
1
- import type { AppSpecService } from '@pulumi/digitalocean/types/input';
2
- import type { Output } from '@pulumi/pulumi';
3
- import type { ServiceConfig } from '../types';
4
- export interface BuildServicesOptions {
5
- serviceConfigs: ServiceConfig[];
6
- registryCredentials: Output<string>;
7
- logtailToken: Output<string>;
8
- /** GHCR registry/org name (e.g., 'orderboss') */
9
- registry: string;
10
- }
11
- /**
12
- * Builds the services array from service configs.
13
- *
14
- * Services are sorted so that the service with ingressPrefix "/" comes first,
15
- * as DigitalOcean automatically routes the first service with httpPort to "/"
16
- * when no explicit ingress rule exists for that path.
17
- */
18
- export declare function buildServices(options: BuildServicesOptions): AppSpecService[];
19
- /**
20
- * Builds the ingress rules from service configs.
21
- * Only includes services that have both an ingressPrefix AND httpPort defined.
22
- * Services with only internalPorts cannot have ingress rules.
23
- *
24
- * Rules are sorted by prefix length (longest first) to ensure more specific
25
- * paths are matched before catch-all paths like "/".
26
- *
27
- * Note: Root path "/" is excluded from explicit rules as DigitalOcean automatically
28
- * routes the first service with httpPort to "/" when no explicit rule exists.
29
- */
30
- export declare function buildIngressRules(serviceConfigs: ServiceConfig[]): {
31
- component: {
32
- name: (import("@pulumi/pulumi").Input<string> | undefined) & string;
33
- };
34
- match: {
35
- path: {
36
- prefix: string;
37
- };
38
- };
39
- }[];
@@ -1,22 +0,0 @@
1
- /**
2
- * Runtime helpers for services to access their configuration.
3
- * These functions read from environment variables set by generate-env (local)
4
- * or injected by DO App Platform (production).
5
- */
6
- /**
7
- * Get the port for a service from environment variables.
8
- * Reads from SERVICE_NAME_PORT (e.g., ORDERS_PORT, API_GATEWAY_PORT)
9
- *
10
- * @param serviceName - The service name (e.g., 'orders', 'api-gateway')
11
- * @param defaultPort - Fallback port if env var is not set (default: 8080)
12
- * @returns The configured port number
13
- */
14
- export declare function getServicePort(serviceName: string, defaultPort?: number): number;
15
- /**
16
- * Get the URL for a service from environment variables.
17
- * Reads from SERVICE_NAME_URL (e.g., ORDERS_URL, API_GATEWAY_URL)
18
- *
19
- * @param serviceName - The service name (e.g., 'orders', 'api-gateway')
20
- * @returns The service URL or undefined if not set
21
- */
22
- export declare function getServiceUrl(serviceName: string): string | undefined;
@@ -1,27 +0,0 @@
1
- import type { AppSpecEnv } from '@pulumi/digitalocean/types/input';
2
- import type { ServiceConfig } from '../types';
3
- /**
4
- * Generate internal service URLs for service-to-service communication.
5
- * Uses DigitalOcean App Platform's internal DNS (e.g., http://orders:3001)
6
- * Uses internalUrl if defined, otherwise defaults to http://{name}:{port}
7
- */
8
- export declare function buildInternalUrls(serviceConfigs: ServiceConfig[]): Record<string, string>;
9
- /**
10
- * Generate external service URLs based on primary domain and ingress prefix.
11
- */
12
- export declare function buildExternalUrls(serviceConfigs: ServiceConfig[], baseUrl: string): Record<string, string>;
13
- /**
14
- * Generate local development URLs (localhost with configured ports).
15
- */
16
- export declare function buildLocalUrls(serviceConfigs: ServiceConfig[]): Record<string, string>;
17
- /**
18
- * Generate environment variables for service URLs.
19
- * Used to inject service URLs into DO App Platform.
20
- * Uses internalUrl if defined, otherwise defaults to http://{name}:{port}
21
- */
22
- export declare function buildServiceUrlEnvs(serviceConfigs: ServiceConfig[]): AppSpecEnv[];
23
- /**
24
- * Generate environment variables for service ports.
25
- * Used to inject service ports into DO App Platform.
26
- */
27
- export declare function buildServicePortEnvs(serviceConfigs: ServiceConfig[]): AppSpecEnv[];