@crossdelta/infrastructure 0.11.2 → 0.11.4

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/dist/index.cjs CHANGED
@@ -1171,8 +1171,11 @@ var generateHandleBlock = (handle, level, basicAuth) => {
1171
1171
  ${inner}
1172
1172
  }`, level);
1173
1173
  };
1174
- var generateRouteBlock = (route) => {
1174
+ var generateRouteBlock = (route, encode) => {
1175
1175
  const body = [];
1176
+ if (!route.redirect && encode?.length) {
1177
+ body.push(` encode ${encode.join(" ")}`);
1178
+ }
1176
1179
  if (route.handles && route.handles.length > 0) {
1177
1180
  for (const handle of route.handles) {
1178
1181
  body.push(generateHandleBlock(handle, 1, route.basicAuth));
@@ -1208,8 +1211,14 @@ var generateGlobalBlock = (config) => {
1208
1211
  return lines.join(`
1209
1212
  `);
1210
1213
  };
1211
- var generateCatchAllBlock = (upstream) => ["https:// {", " tls {", " on_demand", " }", ` reverse_proxy ${upstream}`, "}"].join(`
1214
+ var generateCatchAllBlock = (upstream, encode) => {
1215
+ const lines = ["https:// {", " tls {", " on_demand", " }"];
1216
+ if (encode?.length)
1217
+ lines.push(` encode ${encode.join(" ")}`);
1218
+ lines.push(` reverse_proxy ${upstream}`, "}");
1219
+ return lines.join(`
1212
1220
  `);
1221
+ };
1213
1222
  var buildResourceSpec = (config, defaults) => {
1214
1223
  const resources = config ?? defaults ?? CADDY_DEFAULTS.resources;
1215
1224
  return {
@@ -1224,9 +1233,9 @@ var generateCaddyfile = (config) => {
1224
1233
  }`;
1225
1234
  const blocks = [
1226
1235
  generateGlobalBlock(config),
1227
- ...config.routes.map(generateRouteBlock),
1236
+ ...config.routes.map((route) => generateRouteBlock(route, config.encode)),
1228
1237
  healthCheckBlock,
1229
- ...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream)] : []
1238
+ ...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream, config.encode)] : []
1230
1239
  ];
1231
1240
  return blocks.join(`
1232
1241
 
@@ -1285,6 +1294,9 @@ var deployCaddy = (provider, namespace, config) => {
1285
1294
  metadata: { labels },
1286
1295
  spec: {
1287
1296
  containers,
1297
+ ...config.imagePullSecretName && {
1298
+ imagePullSecrets: [{ name: config.imagePullSecretName }]
1299
+ },
1288
1300
  volumes: [
1289
1301
  {
1290
1302
  name: "caddy-data",
package/dist/index.js CHANGED
@@ -1075,8 +1075,11 @@ var generateHandleBlock = (handle, level, basicAuth) => {
1075
1075
  ${inner}
1076
1076
  }`, level);
1077
1077
  };
1078
- var generateRouteBlock = (route) => {
1078
+ var generateRouteBlock = (route, encode) => {
1079
1079
  const body = [];
1080
+ if (!route.redirect && encode?.length) {
1081
+ body.push(` encode ${encode.join(" ")}`);
1082
+ }
1080
1083
  if (route.handles && route.handles.length > 0) {
1081
1084
  for (const handle of route.handles) {
1082
1085
  body.push(generateHandleBlock(handle, 1, route.basicAuth));
@@ -1112,8 +1115,14 @@ var generateGlobalBlock = (config) => {
1112
1115
  return lines.join(`
1113
1116
  `);
1114
1117
  };
1115
- var generateCatchAllBlock = (upstream) => ["https:// {", " tls {", " on_demand", " }", ` reverse_proxy ${upstream}`, "}"].join(`
1118
+ var generateCatchAllBlock = (upstream, encode) => {
1119
+ const lines = ["https:// {", " tls {", " on_demand", " }"];
1120
+ if (encode?.length)
1121
+ lines.push(` encode ${encode.join(" ")}`);
1122
+ lines.push(` reverse_proxy ${upstream}`, "}");
1123
+ return lines.join(`
1116
1124
  `);
1125
+ };
1117
1126
  var buildResourceSpec = (config, defaults) => {
1118
1127
  const resources = config ?? defaults ?? CADDY_DEFAULTS.resources;
1119
1128
  return {
@@ -1128,9 +1137,9 @@ var generateCaddyfile = (config) => {
1128
1137
  }`;
1129
1138
  const blocks = [
1130
1139
  generateGlobalBlock(config),
1131
- ...config.routes.map(generateRouteBlock),
1140
+ ...config.routes.map((route) => generateRouteBlock(route, config.encode)),
1132
1141
  healthCheckBlock,
1133
- ...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream)] : []
1142
+ ...config.catchAllUpstream && config.onDemandTls ? [generateCatchAllBlock(config.catchAllUpstream, config.encode)] : []
1134
1143
  ];
1135
1144
  return blocks.join(`
1136
1145
 
@@ -1189,6 +1198,9 @@ var deployCaddy = (provider, namespace, config) => {
1189
1198
  metadata: { labels },
1190
1199
  spec: {
1191
1200
  containers,
1201
+ ...config.imagePullSecretName && {
1202
+ imagePullSecrets: [{ name: config.imagePullSecretName }]
1203
+ },
1192
1204
  volumes: [
1193
1205
  {
1194
1206
  name: "caddy-data",
@@ -445,6 +445,8 @@ export interface CaddyConfig {
445
445
  acmeEmail?: string;
446
446
  /** Additional containers in the Caddy pod (e.g., /ask sidecar) */
447
447
  sidecars?: k8s.types.input.core.v1.Container[];
448
+ /** Secret name for pulling private container images */
449
+ imagePullSecretName?: string;
448
450
  /** Resource limits for the Caddy container */
449
451
  resources?: K8sResourceConfig;
450
452
  /** Persistent storage for certs and OCSP cache */
@@ -457,6 +459,8 @@ export interface CaddyConfig {
457
459
  port: number;
458
460
  path: string;
459
461
  };
462
+ /** Response encoding (e.g., ['zstd', 'gzip']). Omit to disable. */
463
+ encode?: string[];
460
464
  }
461
465
  export interface CaddyResult {
462
466
  /** The Kubernetes Deployment */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossdelta/infrastructure",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {