create-svc 0.1.70 → 0.1.71
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.
package/package.json
CHANGED
|
@@ -62,6 +62,28 @@ test("resolveTemporalRuntimeConfigValues reads self-hosted mTLS config from Vaul
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
test("resolveTemporalRuntimeConfigValues renders configured mTLS secret names without raw credentials", () => {
|
|
66
|
+
const resolved = resolveTemporalRuntimeConfigValues(
|
|
67
|
+
{ ...baseConfig, address: "temporal-grpc.anmho.com:7233" },
|
|
68
|
+
{},
|
|
69
|
+
() => ({
|
|
70
|
+
namespace: "default",
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
expect(resolved).toMatchObject({
|
|
75
|
+
enabled: true,
|
|
76
|
+
address: "temporal-grpc.anmho.com:7233",
|
|
77
|
+
namespace: "default",
|
|
78
|
+
tlsCaCertSecretName: "orders-temporal-ca-cert",
|
|
79
|
+
tlsCertSecretName: "orders-temporal-client-cert",
|
|
80
|
+
tlsKeySecretName: "orders-temporal-client-key",
|
|
81
|
+
tlsCaCert: "",
|
|
82
|
+
tlsCert: "",
|
|
83
|
+
tlsKey: "",
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
65
87
|
test("resolveTemporalRuntimeConfigValues prefers explicit environment overrides", () => {
|
|
66
88
|
const resolved = resolveTemporalRuntimeConfigValues(
|
|
67
89
|
baseConfig,
|
|
@@ -75,6 +75,13 @@ export function resolveTemporalRuntimeConfigValues(
|
|
|
75
75
|
env.TEMPORAL_TLS_CERT_SECRET?.trim() || (tlsCert ? config.tlsCertSecretName || `${config.taskQueue}-temporal-client-cert` : "");
|
|
76
76
|
const tlsKeySecretName =
|
|
77
77
|
env.TEMPORAL_TLS_KEY_SECRET?.trim() || (tlsKey ? config.tlsKeySecretName || `${config.taskQueue}-temporal-client-key` : "");
|
|
78
|
+
const configuredTLSSecretNames = Boolean(config.tlsCaCertSecretName && config.tlsCertSecretName && config.tlsKeySecretName);
|
|
79
|
+
const shouldRenderTLSSecretNames = Boolean(tlsCaCert || (!apiKey && configuredTLSSecretNames));
|
|
80
|
+
const resolvedTLSSecretNames = {
|
|
81
|
+
ca: shouldRenderTLSSecretNames ? tlsCaCertSecretName || config.tlsCaCertSecretName || "" : "",
|
|
82
|
+
cert: shouldRenderTLSSecretNames ? tlsCertSecretName || config.tlsCertSecretName || "" : "",
|
|
83
|
+
key: shouldRenderTLSSecretNames ? tlsKeySecretName || config.tlsKeySecretName || "" : "",
|
|
84
|
+
};
|
|
78
85
|
|
|
79
86
|
if (isLocalTemporalAddress(address)) {
|
|
80
87
|
throw new Error(
|
|
@@ -95,7 +102,7 @@ export function resolveTemporalRuntimeConfigValues(
|
|
|
95
102
|
`Temporal mTLS is partially configured; set TEMPORAL_TLS_CA_CERT, TEMPORAL_TLS_CERT, and TEMPORAL_TLS_KEY together in env or Vault at ${config.vaultMount}/${config.vaultPath}`
|
|
96
103
|
);
|
|
97
104
|
}
|
|
98
|
-
if (!apiKey && !tlsCaCert) {
|
|
105
|
+
if (!apiKey && !apiKeySecretName && !tlsCaCert && !configuredTLSSecretNames) {
|
|
99
106
|
throw new Error(
|
|
100
107
|
`Temporal is enabled but no credentials were found; set TEMPORAL_API_KEY or TEMPORAL_TLS_CA_CERT/TEMPORAL_TLS_CERT/TEMPORAL_TLS_KEY in env or Vault at ${config.vaultMount}/${config.vaultPath}`
|
|
101
108
|
);
|
|
@@ -108,9 +115,9 @@ export function resolveTemporalRuntimeConfigValues(
|
|
|
108
115
|
taskQueue,
|
|
109
116
|
apiKeySecretName,
|
|
110
117
|
apiKey,
|
|
111
|
-
tlsCaCertSecretName,
|
|
112
|
-
tlsCertSecretName,
|
|
113
|
-
tlsKeySecretName,
|
|
118
|
+
tlsCaCertSecretName: resolvedTLSSecretNames.ca,
|
|
119
|
+
tlsCertSecretName: resolvedTLSSecretNames.cert,
|
|
120
|
+
tlsKeySecretName: resolvedTLSSecretNames.key,
|
|
114
121
|
tlsCaCert,
|
|
115
122
|
tlsCert,
|
|
116
123
|
tlsKey,
|