@crossdelta/infrastructure 0.2.10 → 0.2.11

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.
@@ -8,6 +8,10 @@ export interface BuildServicesOptions {
8
8
  }
9
9
  /**
10
10
  * Builds the services array from service configs.
11
+ *
12
+ * Services are sorted so that the service with ingressPrefix "/" comes first,
13
+ * as DigitalOcean automatically routes the first service with httpPort to "/"
14
+ * when no explicit ingress rule exists for that path.
11
15
  */
12
16
  export declare function buildServices(options: BuildServicesOptions): AppSpecService[];
13
17
  /**
@@ -17,6 +21,9 @@ export declare function buildServices(options: BuildServicesOptions): AppSpecSer
17
21
  *
18
22
  * Rules are sorted by prefix length (longest first) to ensure more specific
19
23
  * paths are matched before catch-all paths like "/".
24
+ *
25
+ * Note: Root path "/" is excluded from explicit rules as DigitalOcean automatically
26
+ * routes the first service with httpPort to "/" when no explicit rule exists.
20
27
  */
21
28
  export declare function buildIngressRules(serviceConfigs: ServiceConfig[]): {
22
29
  component: {
package/dist/index.cjs CHANGED
@@ -174,7 +174,14 @@ var getImage = (repository, registryCredentials) => {
174
174
  function buildServices(options) {
175
175
  const { serviceConfigs, registryCredentials, logtailToken } = options;
176
176
  const logDestinations = createLogDestinations(logtailToken);
177
- return serviceConfigs.map((config) => {
177
+ const sortedConfigs = [...serviceConfigs].sort((a, b) => {
178
+ if (a.ingressPrefix === "/")
179
+ return -1;
180
+ if (b.ingressPrefix === "/")
181
+ return 1;
182
+ return 0;
183
+ });
184
+ return sortedConfigs.map((config) => {
178
185
  const {
179
186
  ingressPrefix: _ingressPrefix,
180
187
  skip: _skip,
@@ -193,7 +200,7 @@ function buildServices(options) {
193
200
  });
194
201
  }
195
202
  function buildIngressRules(serviceConfigs) {
196
- return serviceConfigs.filter((config) => config.ingressPrefix !== undefined && config.httpPort !== undefined).map((config) => ({
203
+ return serviceConfigs.filter((config) => config.ingressPrefix !== undefined && config.ingressPrefix !== "/" && config.httpPort !== undefined).map((config) => ({
197
204
  component: { name: config.name },
198
205
  match: {
199
206
  path: {
package/dist/index.js CHANGED
@@ -126,7 +126,14 @@ var getImage = (repository, registryCredentials) => {
126
126
  function buildServices(options) {
127
127
  const { serviceConfigs, registryCredentials, logtailToken } = options;
128
128
  const logDestinations = createLogDestinations(logtailToken);
129
- return serviceConfigs.map((config) => {
129
+ const sortedConfigs = [...serviceConfigs].sort((a, b) => {
130
+ if (a.ingressPrefix === "/")
131
+ return -1;
132
+ if (b.ingressPrefix === "/")
133
+ return 1;
134
+ return 0;
135
+ });
136
+ return sortedConfigs.map((config) => {
130
137
  const {
131
138
  ingressPrefix: _ingressPrefix,
132
139
  skip: _skip,
@@ -145,7 +152,7 @@ function buildServices(options) {
145
152
  });
146
153
  }
147
154
  function buildIngressRules(serviceConfigs) {
148
- return serviceConfigs.filter((config) => config.ingressPrefix !== undefined && config.httpPort !== undefined).map((config) => ({
155
+ return serviceConfigs.filter((config) => config.ingressPrefix !== undefined && config.ingressPrefix !== "/" && config.httpPort !== undefined).map((config) => ({
149
156
  component: { name: config.name },
150
157
  match: {
151
158
  path: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossdelta/infrastructure",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {