@geekmidas/cli 10.0.0-alpha.145 → 10.0.0-alpha.146

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.
Files changed (185) hide show
  1. package/dist/{GoDaddyProvider-IVuFcWyc.mjs → GoDaddyProvider-BESq24p-.mjs} +2 -2
  2. package/dist/{GoDaddyProvider-IVuFcWyc.mjs.map → GoDaddyProvider-BESq24p-.mjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-DAJIa64i.cjs → GoDaddyProvider-BK5N6-fx.cjs} +2 -2
  4. package/dist/{GoDaddyProvider-DAJIa64i.cjs.map → GoDaddyProvider-BK5N6-fx.cjs.map} +1 -1
  5. package/dist/{HostingerProvider-BtLb-jkn.mjs → HostingerProvider-BV30wTNI.mjs} +2 -2
  6. package/dist/{HostingerProvider-BtLb-jkn.mjs.map → HostingerProvider-BV30wTNI.mjs.map} +1 -1
  7. package/dist/{HostingerProvider-DdikWVRy.cjs → HostingerProvider-BbQod5OB.cjs} +2 -2
  8. package/dist/{HostingerProvider-DdikWVRy.cjs.map → HostingerProvider-BbQod5OB.cjs.map} +1 -1
  9. package/dist/{LegacyStateStore-CmgUY9kR.mjs → LegacyStateStore-Ck3HI28A.mjs} +2 -2
  10. package/dist/{LegacyStateStore-CmgUY9kR.mjs.map → LegacyStateStore-Ck3HI28A.mjs.map} +1 -1
  11. package/dist/{LegacyStateStore-CWwT7Mj5.cjs → LegacyStateStore-OEno6vIb.cjs} +2 -2
  12. package/dist/{LegacyStateStore-CWwT7Mj5.cjs.map → LegacyStateStore-OEno6vIb.cjs.map} +1 -1
  13. package/dist/{LocalStateStore-NOmS4QyA.mjs → LocalStateStore-Fa54CpLw.mjs} +2 -2
  14. package/dist/{LocalStateStore-NOmS4QyA.mjs.map → LocalStateStore-Fa54CpLw.mjs.map} +1 -1
  15. package/dist/{LocalStateStore-BkeQg1ga.cjs → LocalStateStore-ukDFg6GM.cjs} +2 -2
  16. package/dist/{LocalStateStore-BkeQg1ga.cjs.map → LocalStateStore-ukDFg6GM.cjs.map} +1 -1
  17. package/dist/{S3StateStore-Cw2nwI5C.cjs → S3StateStore-Cjuft2Lk.cjs} +4 -4
  18. package/dist/{S3StateStore-Cw2nwI5C.cjs.map → S3StateStore-Cjuft2Lk.cjs.map} +1 -1
  19. package/dist/{S3StateStore-SjIxuWHM.mjs → S3StateStore-D53985SR.mjs} +4 -4
  20. package/dist/{S3StateStore-SjIxuWHM.mjs.map → S3StateStore-D53985SR.mjs.map} +1 -1
  21. package/dist/{SSMStateStore-DGqzo4Ob.mjs → SSMStateStore-CRjV2h2G.mjs} +2 -2
  22. package/dist/{SSMStateStore-DGqzo4Ob.mjs.map → SSMStateStore-CRjV2h2G.mjs.map} +1 -1
  23. package/dist/{SSMStateStore-DC1N1Baw.cjs → SSMStateStore-CnJgw3_-.cjs} +2 -2
  24. package/dist/{SSMStateStore-DC1N1Baw.cjs.map → SSMStateStore-CnJgw3_-.cjs.map} +1 -1
  25. package/dist/{add-BwC_EH0e.cjs → add-CG_4mNir.cjs} +7 -7
  26. package/dist/{add-BwC_EH0e.cjs.map → add-CG_4mNir.cjs.map} +1 -1
  27. package/dist/{add-Bnd7vuUN.mjs → add-D0-1UyFj.mjs} +7 -7
  28. package/dist/{add-Bnd7vuUN.mjs.map → add-D0-1UyFj.mjs.map} +1 -1
  29. package/dist/{apps-D1svw9OG.cjs → apps-DHi6E_yH.cjs} +416 -51
  30. package/dist/apps-DHi6E_yH.cjs.map +1 -0
  31. package/dist/{apps-Xrlvir2-.mjs → apps-DWALM-8s.mjs} +389 -49
  32. package/dist/apps-DWALM-8s.mjs.map +1 -0
  33. package/dist/{bundler-CoRIF5bx.mjs → bundler-Cb5ynXXS.mjs} +6 -6
  34. package/dist/{bundler-CoRIF5bx.mjs.map → bundler-Cb5ynXXS.mjs.map} +1 -1
  35. package/dist/{bundler-CgWYsgqb.cjs → bundler-Co_7zpYC.cjs} +6 -6
  36. package/dist/{bundler-CgWYsgqb.cjs.map → bundler-Co_7zpYC.cjs.map} +1 -1
  37. package/dist/{cli-DsPHbC7p.cjs → cli-C5M_7Kux.cjs} +4 -4
  38. package/dist/{cli-DsPHbC7p.cjs.map → cli-C5M_7Kux.cjs.map} +1 -1
  39. package/dist/{cli-CKlTRVwo.mjs → cli-D_9WqN6C.mjs} +4 -4
  40. package/dist/{cli-CKlTRVwo.mjs.map → cli-D_9WqN6C.mjs.map} +1 -1
  41. package/dist/{compose-BMTnoIek.mjs → compose-7p0-3ogo.mjs} +5 -5
  42. package/dist/compose-7p0-3ogo.mjs.map +1 -0
  43. package/dist/{compose-ChUQHKG3.cjs → compose-BeQ01iYk.cjs} +27 -25
  44. package/dist/compose-BeQ01iYk.cjs.map +1 -0
  45. package/dist/{compose-CVAoA04l.cjs → compose-C10hkeHU.cjs} +5 -5
  46. package/dist/compose-C10hkeHU.cjs.map +1 -0
  47. package/dist/{compose-CkvPmijw.mjs → compose-DxmEMeTu.mjs} +27 -25
  48. package/dist/compose-DxmEMeTu.mjs.map +1 -0
  49. package/dist/{config-BKpzKP6W.mjs → config-B-wza0Xk.mjs} +2 -2
  50. package/dist/{config-BKpzKP6W.mjs.map → config-B-wza0Xk.mjs.map} +1 -1
  51. package/dist/{config-QAqAEgb0.cjs → config-CWExbDxA.cjs} +2 -2
  52. package/dist/{config-QAqAEgb0.cjs.map → config-CWExbDxA.cjs.map} +1 -1
  53. package/dist/config.cjs +2 -2
  54. package/dist/config.mjs +2 -2
  55. package/dist/{credentials-Jx1Vdisc.mjs → credentials-B5Oe4fLE.mjs} +7 -7
  56. package/dist/{credentials-Jx1Vdisc.mjs.map → credentials-B5Oe4fLE.mjs.map} +1 -1
  57. package/dist/{credentials-CCIXh-cq.cjs → credentials-Csnd7M8M.cjs} +7 -7
  58. package/dist/{credentials-CCIXh-cq.cjs.map → credentials-Csnd7M8M.cjs.map} +1 -1
  59. package/dist/deploy/public.cjs +12 -12
  60. package/dist/deploy/public.mjs +12 -12
  61. package/dist/{deploy-8wsaNpPW.mjs → deploy-6DDEG4Ai.mjs} +13 -13
  62. package/dist/{deploy-8wsaNpPW.mjs.map → deploy-6DDEG4Ai.mjs.map} +1 -1
  63. package/dist/{deploy-CEX0YRdq.cjs → deploy-BwNxJ3ZI.cjs} +13 -13
  64. package/dist/{deploy-CEX0YRdq.cjs.map → deploy-BwNxJ3ZI.cjs.map} +1 -1
  65. package/dist/{docker-M_-xKiFU.cjs → docker-BZnNUJCy.cjs} +5 -5
  66. package/dist/{docker-M_-xKiFU.cjs.map → docker-BZnNUJCy.cjs.map} +1 -1
  67. package/dist/{docker-M4kCqczV.mjs → docker-Ch5aPQ04.mjs} +5 -5
  68. package/dist/{docker-M4kCqczV.mjs.map → docker-Ch5aPQ04.mjs.map} +1 -1
  69. package/dist/{dokploy-BsAPW8K1.mjs → dokploy-CTWw3WSo.mjs} +2 -2
  70. package/dist/{dokploy-BsAPW8K1.mjs.map → dokploy-CTWw3WSo.mjs.map} +1 -1
  71. package/dist/{dokploy-Djm8QIQZ.cjs → dokploy-Cn7dQqmE.cjs} +2 -2
  72. package/dist/{dokploy-Djm8QIQZ.cjs.map → dokploy-Cn7dQqmE.cjs.map} +1 -1
  73. package/dist/{eas-zEpuiYYj.mjs → eas-D0B8H7hT.mjs} +3 -3
  74. package/dist/{eas-zEpuiYYj.mjs.map → eas-D0B8H7hT.mjs.map} +1 -1
  75. package/dist/{eas-B-Ac5NjL.cjs → eas-IPjz0PWK.cjs} +3 -3
  76. package/dist/{eas-B-Ac5NjL.cjs.map → eas-IPjz0PWK.cjs.map} +1 -1
  77. package/dist/{encryption-EOEhb95p.mjs → encryption-C9auXcSV.mjs} +4 -4
  78. package/dist/{encryption-EOEhb95p.mjs.map → encryption-C9auXcSV.mjs.map} +1 -1
  79. package/dist/{encryption-B4LCEdXH.cjs → encryption-vK64UP4M.cjs} +4 -4
  80. package/dist/{encryption-B4LCEdXH.cjs.map → encryption-vK64UP4M.cjs.map} +1 -1
  81. package/dist/{engine-Ci-uU3kt.mjs → engine-C3N2WhbC.mjs} +10 -10
  82. package/dist/{engine-Ci-uU3kt.mjs.map → engine-C3N2WhbC.mjs.map} +1 -1
  83. package/dist/{engine-6NLOikTQ.cjs → engine-Icqv5JI6.cjs} +10 -10
  84. package/dist/{engine-6NLOikTQ.cjs.map → engine-Icqv5JI6.cjs.map} +1 -1
  85. package/dist/{github-C0oLDg5G.mjs → github-D24wTOe2.mjs} +9 -9
  86. package/dist/{github-C0oLDg5G.mjs.map → github-D24wTOe2.mjs.map} +1 -1
  87. package/dist/{github-u9sfpl0l.cjs → github-DUuNInc0.cjs} +9 -9
  88. package/dist/{github-u9sfpl0l.cjs.map → github-DUuNInc0.cjs.map} +1 -1
  89. package/dist/{googlePlay-DfLH_sPa.cjs → googlePlay-BGDKlnPx.cjs} +5 -5
  90. package/dist/{googlePlay-DfLH_sPa.cjs.map → googlePlay-BGDKlnPx.cjs.map} +1 -1
  91. package/dist/{googlePlay-3nfA-wWh.mjs → googlePlay-Cy-MaYr2.mjs} +5 -5
  92. package/dist/{googlePlay-3nfA-wWh.mjs.map → googlePlay-Cy-MaYr2.mjs.map} +1 -1
  93. package/dist/index.cjs +71 -79
  94. package/dist/index.cjs.map +1 -1
  95. package/dist/index.mjs +71 -79
  96. package/dist/index.mjs.map +1 -1
  97. package/dist/{local-CtzKG55y.cjs → local-B4xobzh-.cjs} +2 -2
  98. package/dist/{local-CtzKG55y.cjs.map → local-B4xobzh-.cjs.map} +1 -1
  99. package/dist/{local-uvqZDwZ9.mjs → local-CdpBgn3d.mjs} +2 -2
  100. package/dist/{local-uvqZDwZ9.mjs.map → local-CdpBgn3d.mjs.map} +1 -1
  101. package/dist/{migrate-C6V9bEVY.cjs → migrate--hMBtpx-.cjs} +4 -4
  102. package/dist/{migrate-C6V9bEVY.cjs.map → migrate--hMBtpx-.cjs.map} +1 -1
  103. package/dist/{migrate-CA1GWA4t.mjs → migrate-DVrXTq58.mjs} +4 -4
  104. package/dist/{migrate-CA1GWA4t.mjs.map → migrate-DVrXTq58.mjs.map} +1 -1
  105. package/dist/{migrate-s9lVmF98.mjs → migrate-DhZfvCkJ.mjs} +6 -6
  106. package/dist/{migrate-s9lVmF98.mjs.map → migrate-DhZfvCkJ.mjs.map} +1 -1
  107. package/dist/{migrate-FKPFIzwd.cjs → migrate-DwQ-zaMy.cjs} +6 -6
  108. package/dist/{migrate-FKPFIzwd.cjs.map → migrate-DwQ-zaMy.cjs.map} +1 -1
  109. package/dist/{notes-BjxySbyH.cjs → notes-C2b5RzGl.cjs} +4 -4
  110. package/dist/{notes-BjxySbyH.cjs.map → notes-C2b5RzGl.cjs.map} +1 -1
  111. package/dist/{notes-Dz1M9_q9.mjs → notes-z5OOMqm4.mjs} +4 -4
  112. package/dist/{notes-Dz1M9_q9.mjs.map → notes-z5OOMqm4.mjs.map} +1 -1
  113. package/dist/openapi.cjs +2 -2
  114. package/dist/openapi.mjs +2 -2
  115. package/dist/{projectBucket-2XgQSnLw.mjs → projectBucket-DPD0_B8N.mjs} +2 -2
  116. package/dist/{projectBucket-2XgQSnLw.mjs.map → projectBucket-DPD0_B8N.mjs.map} +1 -1
  117. package/dist/{projectBucket-DsXNW1Yc.cjs → projectBucket-Dk_aZ1cD.cjs} +2 -2
  118. package/dist/{projectBucket-DsXNW1Yc.cjs.map → projectBucket-Dk_aZ1cD.cjs.map} +1 -1
  119. package/dist/{publish-Dmy_OhvF.mjs → publish-Bmc1Wfs3.mjs} +2 -2
  120. package/dist/{publish-Dmy_OhvF.mjs.map → publish-Bmc1Wfs3.mjs.map} +1 -1
  121. package/dist/{publish-7-dwP5TL.cjs → publish-CDvh-9OG.cjs} +2 -2
  122. package/dist/{publish-7-dwP5TL.cjs.map → publish-CDvh-9OG.cjs.map} +1 -1
  123. package/dist/{resolve-DhsUJwm8.cjs → resolve-CuxPZ3ga.cjs} +4 -4
  124. package/dist/{resolve-DhsUJwm8.cjs.map → resolve-CuxPZ3ga.cjs.map} +1 -1
  125. package/dist/{resolve-BK7mzDBb.mjs → resolve-DHARlMdl.mjs} +4 -4
  126. package/dist/{resolve-BK7mzDBb.mjs.map → resolve-DHARlMdl.mjs.map} +1 -1
  127. package/dist/{rollback-8qHgyadV.mjs → rollback-DZq_dIbl.mjs} +7 -7
  128. package/dist/{rollback-8qHgyadV.mjs.map → rollback-DZq_dIbl.mjs.map} +1 -1
  129. package/dist/{rollback-DP2iDjc9.cjs → rollback-DxHut8C-.cjs} +7 -7
  130. package/dist/{rollback-DP2iDjc9.cjs.map → rollback-DxHut8C-.cjs.map} +1 -1
  131. package/dist/{s3-DxCex5Fx.mjs → s3-Cd7UK2y8.mjs} +3 -3
  132. package/dist/{s3-DxCex5Fx.mjs.map → s3-Cd7UK2y8.mjs.map} +1 -1
  133. package/dist/{s3-DSPbU5gN.cjs → s3-Dhy58V_y.cjs} +3 -3
  134. package/dist/{s3-DSPbU5gN.cjs.map → s3-Dhy58V_y.cjs.map} +1 -1
  135. package/dist/{serverSetup-BSuHk2t2.cjs → serverSetup-DYiKHMVp.cjs} +7 -7
  136. package/dist/{serverSetup-BSuHk2t2.cjs.map → serverSetup-DYiKHMVp.cjs.map} +1 -1
  137. package/dist/{serverSetup-CeFpl5VJ.mjs → serverSetup-qe5bdBhO.mjs} +7 -7
  138. package/dist/{serverSetup-CeFpl5VJ.mjs.map → serverSetup-qe5bdBhO.mjs.map} +1 -1
  139. package/dist/{sniffer-BfNl8jn-.mjs → sniffer-BNcLP8MO.mjs} +7 -7
  140. package/dist/{sniffer-BfNl8jn-.mjs.map → sniffer-BNcLP8MO.mjs.map} +1 -1
  141. package/dist/{sniffer-Cb3n63dY.cjs → sniffer-DFix2ORf.cjs} +7 -7
  142. package/dist/{sniffer-Cb3n63dY.cjs.map → sniffer-DFix2ORf.cjs.map} +1 -1
  143. package/dist/{snsSubscriptions-DoZ0Q1n6.mjs → snsSubscriptions-BwX28_Kl.mjs} +3 -3
  144. package/dist/{snsSubscriptions-DoZ0Q1n6.mjs.map → snsSubscriptions-BwX28_Kl.mjs.map} +1 -1
  145. package/dist/{snsSubscriptions-Bd40ebt6.cjs → snsSubscriptions-Dr-gJWtR.cjs} +3 -3
  146. package/dist/{snsSubscriptions-Bd40ebt6.cjs.map → snsSubscriptions-Dr-gJWtR.cjs.map} +1 -1
  147. package/dist/{sst-B6RbJp8g.mjs → sst-Bvtx6uZ9.mjs} +5 -5
  148. package/dist/{sst-B6RbJp8g.mjs.map → sst-Bvtx6uZ9.mjs.map} +1 -1
  149. package/dist/{sst-DKNyfTpw.cjs → sst-CoKFPW7f.cjs} +5 -5
  150. package/dist/{sst-DKNyfTpw.cjs.map → sst-CoKFPW7f.cjs.map} +1 -1
  151. package/dist/{stack-DwQ62dKK.mjs → stack-BeSbt_7k.mjs} +100 -45
  152. package/dist/stack-BeSbt_7k.mjs.map +1 -0
  153. package/dist/{stack-UcV-V6Qk.cjs → stack-DbaKGKnI.cjs} +100 -45
  154. package/dist/stack-DbaKGKnI.cjs.map +1 -0
  155. package/dist/{stage-52sKecmS.mjs → stage-BblkSR2C.mjs} +7 -7
  156. package/dist/{stage-52sKecmS.mjs.map → stage-BblkSR2C.mjs.map} +1 -1
  157. package/dist/{stage-C2v5890I.cjs → stage-DI5mzoAi.cjs} +7 -7
  158. package/dist/{stage-C2v5890I.cjs.map → stage-DI5mzoAi.cjs.map} +1 -1
  159. package/dist/{stages-CFI0OiLj.cjs → stages-C-bVwvJZ.cjs} +3 -3
  160. package/dist/{stages-CFI0OiLj.cjs.map → stages-C-bVwvJZ.cjs.map} +1 -1
  161. package/dist/{stages-DoYa81kN.mjs → stages-DBsDvEbo.mjs} +3 -3
  162. package/dist/{stages-DoYa81kN.mjs.map → stages-DBsDvEbo.mjs.map} +1 -1
  163. package/dist/target/public.cjs +1 -1
  164. package/dist/target/public.mjs +1 -1
  165. package/dist/{terminal-DkXWdU0E.cjs → terminal-Bxy_A8iP.cjs} +2 -2
  166. package/dist/{terminal-DkXWdU0E.cjs.map → terminal-Bxy_A8iP.cjs.map} +1 -1
  167. package/dist/{terminal-BDEqpkbO.mjs → terminal-DDqusYW0.mjs} +2 -2
  168. package/dist/{terminal-BDEqpkbO.mjs.map → terminal-DDqusYW0.mjs.map} +1 -1
  169. package/dist/workspace/index.cjs +1 -1
  170. package/dist/workspace/index.mjs +1 -1
  171. package/dist/{workspace-Dkm3HL9e.cjs → workspace-BbbkJDUU.cjs} +5 -5
  172. package/dist/workspace-BbbkJDUU.cjs.map +1 -0
  173. package/dist/{workspace-BbfBFtjn.mjs → workspace-CZGJdcTs.mjs} +5 -5
  174. package/dist/workspace-CZGJdcTs.mjs.map +1 -0
  175. package/package.json +17 -15
  176. package/dist/apps-D1svw9OG.cjs.map +0 -1
  177. package/dist/apps-Xrlvir2-.mjs.map +0 -1
  178. package/dist/compose-BMTnoIek.mjs.map +0 -1
  179. package/dist/compose-CVAoA04l.cjs.map +0 -1
  180. package/dist/compose-ChUQHKG3.cjs.map +0 -1
  181. package/dist/compose-CkvPmijw.mjs.map +0 -1
  182. package/dist/stack-DwQ62dKK.mjs.map +0 -1
  183. package/dist/stack-UcV-V6Qk.cjs.map +0 -1
  184. package/dist/workspace-BbfBFtjn.mjs.map +0 -1
  185. package/dist/workspace-Dkm3HL9e.cjs.map +0 -1
@@ -1,20 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
2
  import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
3
- import { A as eventsBackendFor, U as externalsManifestName, j as providerOf, k as cacheBackendFor } from "./credentials-Jx1Vdisc.mjs";
4
- import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, j as TEST_STAGE, z as telemetryEnv } from "./workspace-BbfBFtjn.mjs";
5
- import { A as objectsWebhookToken, B as portKeys, D as NOTIFICATION_RULE_PREFIX, E as HOST_GATEWAY$1, F as emulatorQueueUrl, I as emulatorTopicArn, K as LOGS_ORG, N as EMULATOR_REGION, O as minioNotificationRule, P as emulatorEndpoint, U as primaryPortKey, V as portsOf, W as serviceAddresses, X as otlpHeaders, f as savePortState, j as watchedBuckets, l as loadPortState, m as loadLocalCredentials, n as composeFor, r as toYaml, rt as rootSite, t as CLUSTER_DATABASE, v as saveLocalCredentials, z as fakeKey } from "./compose-BMTnoIek.mjs";
3
+ import { A as eventsBackendFor, Tt as gkmHome, U as externalsManifestName, j as providerOf, k as cacheBackendFor } from "./credentials-B5Oe4fLE.mjs";
4
+ import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, j as TEST_STAGE, z as telemetryEnv } from "./workspace-CZGJdcTs.mjs";
5
+ import { A as objectsWebhookToken, B as portKeys, D as NOTIFICATION_RULE_PREFIX, E as HOST_GATEWAY$1, F as emulatorQueueUrl, I as emulatorTopicArn, K as LOGS_ORG, N as EMULATOR_REGION, O as minioNotificationRule, P as emulatorEndpoint, U as primaryPortKey, V as portsOf, W as serviceAddresses, X as otlpHeaders, f as savePortState, j as watchedBuckets, l as loadPortState, m as loadLocalCredentials, n as composeFor, r as toYaml, rt as rootSite, t as CLUSTER_DATABASE, v as saveLocalCredentials, z as fakeKey } from "./compose-7p0-3ogo.mjs";
6
6
  import { c as INBOX_RELAY_TOKEN_KEY, d as inboxWebhookUrl, i as readFakes, l as inboxRelayToken, o as objectsRoute, r as readCredentialFakes, u as inboxRelayWorker } from "./SubscriberGenerator-CzPrixYu.mjs";
7
- import { g as appKey, v as protectedSubdomains } from "./config-BKpzKP6W.mjs";
7
+ import { g as appKey, v as protectedSubdomains } from "./config-B-wza0Xk.mjs";
8
8
  import { i as holdsEveryCache, t as DEFAULT_CACHE } from "./types-Y1NfWlyG.mjs";
9
9
  import { u as telemetryArgs } from "./EndpointGenerator-CusLH-9S.mjs";
10
10
  import { i as discover, w as workerEdges, x as eventsEdgeBucket } from "./discover-DbDrCQ8h.mjs";
11
11
  import { dirname, isAbsolute, join, parse, relative, sep } from "node:path";
12
12
  import { existsSync, readFileSync } from "node:fs";
13
- import { chmod, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
14
- import { networkInterfaces } from "node:os";
13
+ import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
14
+ import { hostname, networkInterfaces, userInfo } from "node:os";
15
15
  import { execFile, spawn } from "node:child_process";
16
16
  import { createServer } from "node:net";
17
- import { createHash } from "node:crypto";
17
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes } from "node:crypto";
18
18
  import { CLIENT_IP_HEADER, PUBLIC_PREFIX, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, bucketExpiry, cacheTable, cookieDomain, dependenciesOf, dependentsOf, drawSecret, externalApiUrl, isWildcardSite, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase, wildcardDomainOf } from "@geekmidas/manifest";
19
19
  import { formatKeyring } from "@geekmidas/constructs/encryption";
20
20
  import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
@@ -22,6 +22,7 @@ import * as snsUrl from "@geekmidas/events/sns/url";
22
22
  import * as sqsUrl from "@geekmidas/events/sqs/url";
23
23
  import { cacheTableStatements } from "@geekmidas/cache/postgres";
24
24
  import { promisify } from "node:util";
25
+ import forge from "node-forge";
25
26
  import { CreateBucketCommand, DeleteBucketLifecycleCommand, GetBucketLifecycleConfigurationCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, HeadBucketCommand, ListBucketsCommand, PutBucketLifecycleConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
26
27
  import { CreateTopicCommand, GetTopicAttributesCommand, SNSClient } from "@aws-sdk/client-sns";
27
28
  import { CreateQueueCommand, GetQueueUrlCommand, SQSClient } from "@aws-sdk/client-sqs";
@@ -57,8 +58,10 @@ function processorsDevRoute(fileServerId) {
57
58
  * caching, because caching is not what is missing locally, and a caching proxy
58
59
  * would add an invalidation story a local stack has no use for.
59
60
  *
60
- * What it buys beyond the shape is a certificate. Caddy issues one per host
61
- * from its own CA, so a local address is `https://` like the deployed one, and
61
+ * What it buys beyond the shape is a certificate: gkm's local authority
62
+ * (`trust/authority.ts`) issues one for the stage's hosts, which the edge
63
+ * serves the way a deployed edge serves the stage's own, so a local address is
64
+ * `https://` like the deployed one, and
62
65
  * everything downstream of that — `Secure` cookies, `SameSite`, a cookie domain
63
66
  * with more than one host under it — starts behaving the way it will in
64
67
  * production rather than the way `http://localhost` allows.
@@ -92,12 +95,14 @@ const EDGE_KINDS = {
92
95
  * maps it to the host gateway.
93
96
  */
94
97
  const HOST_GATEWAY = "host.docker.internal";
98
+ /** Where the edge's container reads `.gkm/caddy-sites/` — routes and certificates. */
99
+ const CADDY_SITES_IN_CONTAINER = "/etc/caddy/sites";
95
100
  /**
96
101
  * The suffix every local host shares.
97
102
  *
98
103
  * `.localhost` rather than a made-up TLD because it resolves to loopback
99
104
  * without touching `/etc/hosts` — macOS and systemd-resolved both answer for
100
- * subdomains of it, and Caddy issues internal certificates for it by default.
105
+ * subdomains of it.
101
106
  */
102
107
  const LOCAL_TLD = "localhost";
103
108
  /**
@@ -236,14 +241,14 @@ function stageOf(resource) {
236
241
  function caddyfileRoot() {
237
242
  return `${GENERATED}
238
243
  {
239
- # No ACME, no public DNS: the CA is local and so are the names.
240
- local_certs
244
+ # No ACME, no public DNS: each stage's certificate is gkm's, beside its
245
+ # routes, and the names are local.
241
246
  auto_https disable_redirects
242
247
  }
243
248
 
244
249
  # One file per stage, so two stages share this edge the way they already share
245
250
  # one Postgres and one MinIO.
246
- import /etc/caddy/sites/*.caddy
251
+ import ${CADDY_SITES_IN_CONTAINER}/*.caddy
247
252
  `;
248
253
  }
249
254
  /**
@@ -256,7 +261,7 @@ import /etc/caddy/sites/*.caddy
256
261
  * and signs on the Host header, so forwarding the requested hostname would make
257
262
  * it look for a bucket named after the domain.
258
263
  */
259
- function toCaddyfile(sites) {
264
+ function toCaddyfile(sites, options) {
260
265
  if (sites.length === 0) return `${GENERATED}
261
266
  # No file server is declared in this stage, so it routes nothing.
262
267
  `;
@@ -274,7 +279,7 @@ function toCaddyfile(sites) {
274
279
  }`;
275
280
  return `
276
281
  https://${host} {
277
- tls internal
282
+ tls ${options.certificate} ${options.certificate}
278
283
 
279
284
  # gkm's own header, which only a service of this stack may send: the auth
280
285
  # server rate-limits by the client address it carries.
@@ -325,9 +330,9 @@ const GENERATED = `# Generated by gkm from the construct manifest — do not edi
325
330
  # bucket — which MinIO alone cannot produce: its virtual-host mode reads the
326
331
  # leading label as the bucket name.
327
332
  #
328
- # Certificates come from Caddy's own CA. "gkm dev" and "gkm test" export its
329
- # root and point Node at it, so nothing has to be installed to use these URLs
330
- # from code; a browser needs the root trusted once.
333
+ # Certificates come from gkm's local CA. "gkm dev" and "gkm test" point Node at
334
+ # its root, so nothing has to be installed to use these URLs from code; a
335
+ # browser needs the root trusted once ("gkm trust").
331
336
  `;
332
337
  //#endregion
333
338
  //#region src/telemetry/edges.ts
@@ -2968,6 +2973,352 @@ function toPosix(path) {
2968
2973
  return path.split(sep).join("/");
2969
2974
  }
2970
2975
  //#endregion
2976
+ //#region src/trust/authority.ts
2977
+ /**
2978
+ * gkm's local certificate authority: one per machine, and every local edge's
2979
+ * certificate is issued from it.
2980
+ *
2981
+ * `gkm dev`'s Caddy, a local `gkm compose` stack's Caddy — and anything else
2982
+ * that serves the local stage's `*.localhost` names — serves a certificate
2983
+ * this module issued, the way a deployed stage's edge serves the files
2984
+ * `deploy.compose.tls` names. So there is one root to trust (`gkm trust`), it
2985
+ * exists before any container starts, and a container that calls the stage's
2986
+ * public hosts can be handed it (`NODE_EXTRA_CA_CERTS`) without first copying
2987
+ * it out of a proxy.
2988
+ *
2989
+ * The root lives in the CLI's home (`GKM_HOME`, else `~/.gkm`), outside every
2990
+ * project. Its key never leaves that directory: only certificates it signed —
2991
+ * and their own keys — are written to a workspace or handed to a container.
2992
+ */
2993
+ /** How long the root is good for: ten years, so it is trusted once. */
2994
+ const AUTHORITY_DAYS = 3650;
2995
+ /** An issued certificate this close to its end is issued again. */
2996
+ const RENEW_WITHIN_DAYS = 30;
2997
+ const DAY = 864e5;
2998
+ /** The authority's files, under the CLI's home. */
2999
+ function localAuthorityPaths(home = gkmHome()) {
3000
+ const dir = join(home, "ca");
3001
+ return {
3002
+ dir,
3003
+ certFile: join(dir, "root.pem"),
3004
+ keyFile: join(dir, "root-key.pem")
3005
+ };
3006
+ }
3007
+ /** The authority's directory is there, and its root or key is not readable. */
3008
+ var LocalAuthorityDamaged = class extends GkmError {
3009
+ dir;
3010
+ reason;
3011
+ constructor(dir, reason) {
3012
+ super(`gkm's local certificate authority in ${dir} cannot be used: ${reason}. Delete the directory and run "gkm trust" to make a new one — a browser that trusted the old root has to trust the new one.`);
3013
+ this.dir = dir;
3014
+ this.reason = reason;
3015
+ this.name = "LocalAuthorityDamaged";
3016
+ }
3017
+ };
3018
+ /** A certificate asked for with no names to put on it. */
3019
+ var LocalCertificateWithoutNames = class extends GkmError {
3020
+ constructor() {
3021
+ super("A local certificate needs at least one host name. Pass the hosts the edge serves — localCertificateNames(project, hosts) lists them.");
3022
+ this.name = "LocalCertificateWithoutNames";
3023
+ }
3024
+ };
3025
+ /**
3026
+ * Load the authority, creating it the first time.
3027
+ *
3028
+ * Created whole or not at all: generated into a directory of its own and
3029
+ * renamed into place, so two commands starting at once — `gkm dev` for two
3030
+ * apps — end with one root between them, never one's certificate and the
3031
+ * other's key.
3032
+ *
3033
+ * @throws {LocalAuthorityDamaged} when its directory holds no usable root.
3034
+ */
3035
+ async function ensureLocalAuthority(paths = localAuthorityPaths()) {
3036
+ if (!existsSync(paths.dir)) await createAuthority(paths);
3037
+ return readLocalAuthority(paths);
3038
+ }
3039
+ /**
3040
+ * Load an authority that exists.
3041
+ *
3042
+ * @throws {LocalAuthorityDamaged} when its root or key is missing or unreadable.
3043
+ */
3044
+ async function readLocalAuthority(paths = localAuthorityPaths()) {
3045
+ let cert;
3046
+ let key;
3047
+ try {
3048
+ [cert, key] = await Promise.all([readFile(paths.certFile, "utf-8"), readFile(paths.keyFile, "utf-8")]);
3049
+ } catch {
3050
+ throw new LocalAuthorityDamaged(paths.dir, "its root certificate or key is missing");
3051
+ }
3052
+ try {
3053
+ const root = forge.pki.certificateFromPem(cert);
3054
+ const signer = forge.pki.privateKeyFromPem(key);
3055
+ if (!root.publicKey.n.equals(signer.n)) throw new LocalAuthorityDamaged(paths.dir, "its key is not the root certificate’s");
3056
+ } catch (error) {
3057
+ if (error instanceof LocalAuthorityDamaged) throw error;
3058
+ throw new LocalAuthorityDamaged(paths.dir, "its files are not PEM");
3059
+ }
3060
+ return {
3061
+ certFile: paths.certFile,
3062
+ cert,
3063
+ key
3064
+ };
3065
+ }
3066
+ async function createAuthority(paths) {
3067
+ const { cert, key } = selfSigned();
3068
+ const staging = `${paths.dir}.${process.pid}.${randomBytes(4).toString("hex")}`;
3069
+ await mkdir(staging, {
3070
+ recursive: true,
3071
+ mode: 448
3072
+ });
3073
+ try {
3074
+ await writeFile(join(staging, "root.pem"), cert, { mode: 420 });
3075
+ await writeFile(join(staging, "root-key.pem"), key, { mode: 384 });
3076
+ await mkdir(dirname(paths.dir), { recursive: true });
3077
+ await rename(staging, paths.dir).catch((error) => {
3078
+ if (error.code !== "EEXIST" && error.code !== "ENOTEMPTY") throw error;
3079
+ });
3080
+ } finally {
3081
+ await rm(staging, {
3082
+ recursive: true,
3083
+ force: true
3084
+ });
3085
+ }
3086
+ }
3087
+ /** A new root: who made it, on which machine, so a keychain says whose it is. */
3088
+ function selfSigned() {
3089
+ const { privateKey, publicKey } = keyPair();
3090
+ const cert = forge.pki.createCertificate();
3091
+ cert.publicKey = publicKey;
3092
+ cert.serialNumber = serialNumber();
3093
+ const now = Date.now();
3094
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - DAY);
3095
+ cert.validity.notAfter = new Date(now + AUTHORITY_DAYS * DAY);
3096
+ const subject = utf8([
3097
+ {
3098
+ name: "organizationName",
3099
+ value: "gkm local CA"
3100
+ },
3101
+ {
3102
+ name: "organizationalUnitName",
3103
+ value: owner()
3104
+ },
3105
+ {
3106
+ name: "commonName",
3107
+ value: `gkm local CA ${owner()}`
3108
+ }
3109
+ ]);
3110
+ cert.setSubject(subject);
3111
+ cert.setIssuer(subject);
3112
+ cert.setExtensions([
3113
+ {
3114
+ name: "basicConstraints",
3115
+ cA: true,
3116
+ pathLenConstraint: 0,
3117
+ critical: true
3118
+ },
3119
+ {
3120
+ name: "keyUsage",
3121
+ keyCertSign: true,
3122
+ cRLSign: true,
3123
+ critical: true
3124
+ },
3125
+ { name: "subjectKeyIdentifier" }
3126
+ ]);
3127
+ cert.sign(privateKey, forge.md.sha256.create());
3128
+ return {
3129
+ cert: forge.pki.certificateToPem(cert),
3130
+ key: forge.pki.privateKeyToPem(privateKey)
3131
+ };
3132
+ }
3133
+ /**
3134
+ * The names a project's local certificate carries: its bare host and every
3135
+ * label under it — `shop.localhost`, `*.shop.localhost` — and any host the
3136
+ * edge serves that those do not cover, a stage's own wildcard among them.
3137
+ * Without a project, the hosts alone: `*.localhost` is nobody's to claim.
3138
+ */
3139
+ function localCertificateNames(project, hosts) {
3140
+ const names = [...project ? [`${project}.localhost`, `*.${project}.localhost`] : []];
3141
+ for (const host of hosts) {
3142
+ const name = host.toLowerCase();
3143
+ if (!names.some((covering) => covers(covering, name))) names.push(name);
3144
+ }
3145
+ return names;
3146
+ }
3147
+ /** Whether a certificate name answers for a host, by the one-label wildcard rule. */
3148
+ function covers(name, host) {
3149
+ if (name === host) return true;
3150
+ if (!name.startsWith("*.") || host.startsWith("*.")) return false;
3151
+ const suffix = name.slice(1);
3152
+ return host.endsWith(suffix) && !host.slice(0, -suffix.length).includes(".");
3153
+ }
3154
+ /**
3155
+ * A certificate for `names`, signed by the authority. Each call makes a new
3156
+ * key; {@link ensureLocalCertificate} is what keeps one across runs.
3157
+ *
3158
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3159
+ */
3160
+ function issueLocalCertificate(authority, names, options = {}) {
3161
+ if (names.length === 0) throw new LocalCertificateWithoutNames();
3162
+ const root = forge.pki.certificateFromPem(authority.cert);
3163
+ const signer = forge.pki.privateKeyFromPem(authority.key);
3164
+ const { privateKey, publicKey } = keyPair();
3165
+ const now = (options.now ?? /* @__PURE__ */ new Date()).getTime();
3166
+ const cert = forge.pki.createCertificate();
3167
+ cert.publicKey = publicKey;
3168
+ cert.serialNumber = serialNumber();
3169
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - 36e5);
3170
+ cert.validity.notAfter = new Date(now + (options.days ?? 365) * DAY);
3171
+ cert.setSubject(utf8([{
3172
+ name: "organizationName",
3173
+ value: "gkm local certificate"
3174
+ }, {
3175
+ name: "commonName",
3176
+ value: names[0]
3177
+ }]));
3178
+ cert.setIssuer(root.subject.attributes);
3179
+ cert.setExtensions([
3180
+ {
3181
+ name: "basicConstraints",
3182
+ cA: false,
3183
+ critical: true
3184
+ },
3185
+ {
3186
+ name: "keyUsage",
3187
+ digitalSignature: true,
3188
+ keyEncipherment: true,
3189
+ critical: true
3190
+ },
3191
+ {
3192
+ name: "extKeyUsage",
3193
+ serverAuth: true
3194
+ },
3195
+ {
3196
+ name: "subjectAltName",
3197
+ altNames: names.map((value) => ({
3198
+ type: 2,
3199
+ value
3200
+ }))
3201
+ },
3202
+ { name: "subjectKeyIdentifier" },
3203
+ {
3204
+ name: "authorityKeyIdentifier",
3205
+ keyIdentifier: root.generateSubjectKeyIdentifier().getBytes()
3206
+ }
3207
+ ]);
3208
+ cert.sign(signer, forge.md.sha256.create());
3209
+ return {
3210
+ cert: forge.pki.certificateToPem(cert),
3211
+ key: forge.pki.privateKeyToPem(privateKey)
3212
+ };
3213
+ }
3214
+ /**
3215
+ * The certificate for `names` kept in `file` — certificate then key, one PEM
3216
+ * file, which is what a proxy given the same path for both reads — issued
3217
+ * again only when the one there is not the authority's, does not cover every
3218
+ * name, or is near its end.
3219
+ *
3220
+ * One file written by rename, so two commands issuing at once leave a pair
3221
+ * that matches, never one's certificate beside the other's key.
3222
+ *
3223
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3224
+ */
3225
+ async function ensureLocalCertificate(authority, names, file, options = {}) {
3226
+ const now = options.now ?? /* @__PURE__ */ new Date();
3227
+ const existing = await readFile(file, "utf-8").catch(() => void 0);
3228
+ const kept = existing ? splitPem(existing) : void 0;
3229
+ if (kept && stillGood(authority, kept, names, now)) return {
3230
+ ...kept,
3231
+ issued: false
3232
+ };
3233
+ const issued = issueLocalCertificate(authority, names, { now });
3234
+ await mkdir(dirname(file), {
3235
+ recursive: true,
3236
+ mode: 448
3237
+ });
3238
+ const staging = `${file}.${process.pid}.${randomBytes(4).toString("hex")}`;
3239
+ await writeFile(staging, `${issued.cert}${issued.key}`, { mode: 384 });
3240
+ await rename(staging, file);
3241
+ return {
3242
+ ...issued,
3243
+ issued: true
3244
+ };
3245
+ }
3246
+ /** A combined PEM file's certificate and key. */
3247
+ function splitPem(pem) {
3248
+ const cert = pem.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----\r?\n?/)?.[0];
3249
+ const key = pem.match(/-----BEGIN (?:RSA )?PRIVATE KEY-----[\s\S]+?-----END (?:RSA )?PRIVATE KEY-----\r?\n?/)?.[0];
3250
+ return cert && key ? {
3251
+ cert,
3252
+ key
3253
+ } : void 0;
3254
+ }
3255
+ /** Whether a kept certificate still serves: the authority's, every name, in date. */
3256
+ function stillGood(authority, kept, names, now) {
3257
+ try {
3258
+ const root = forge.pki.certificateFromPem(authority.cert);
3259
+ const cert = forge.pki.certificateFromPem(kept.cert);
3260
+ if (!root.verify(cert)) return false;
3261
+ if (cert.validity.notAfter.getTime() - now.getTime() < RENEW_WITHIN_DAYS * DAY) return false;
3262
+ const certKey = createPublicKey(kept.cert).export({
3263
+ type: "spki",
3264
+ format: "der"
3265
+ });
3266
+ const ownKey = createPublicKey(createPrivateKey(kept.key)).export({
3267
+ type: "spki",
3268
+ format: "der"
3269
+ });
3270
+ if (!certKey.equals(ownKey)) return false;
3271
+ const san = cert.getExtension("subjectAltName");
3272
+ const dns = new Set((san?.altNames ?? []).filter((n) => n.type === 2).map((n) => n.value));
3273
+ return names.every((name) => dns.has(name));
3274
+ } catch {
3275
+ return false;
3276
+ }
3277
+ }
3278
+ /** An RSA key pair, made natively — forge's own generation is slow. */
3279
+ function keyPair() {
3280
+ const { privateKey: pem } = generateKeyPairSync("rsa", {
3281
+ modulusLength: 2048,
3282
+ publicKeyEncoding: {
3283
+ type: "spki",
3284
+ format: "pem"
3285
+ },
3286
+ privateKeyEncoding: {
3287
+ type: "pkcs8",
3288
+ format: "pem"
3289
+ }
3290
+ });
3291
+ const privateKey = forge.pki.privateKeyFromPem(pem);
3292
+ return {
3293
+ privateKey,
3294
+ publicKey: forge.pki.setRsaPublicKey(privateKey.n, privateKey.e)
3295
+ };
3296
+ }
3297
+ /**
3298
+ * Attributes as UTF8String. forge writes PrintableString otherwise, which
3299
+ * has no `@` or `*` — and a TLS stack rejects the certificate outright.
3300
+ */
3301
+ function utf8(attributes) {
3302
+ return attributes.map((attribute) => ({
3303
+ ...attribute,
3304
+ valueTagClass: forge.asn1.Type.UTF8
3305
+ }));
3306
+ }
3307
+ /** A random, positive serial: sixteen bytes, its high bit clear. */
3308
+ function serialNumber() {
3309
+ const bytes = randomBytes(16);
3310
+ bytes[0] = bytes[0] & 127;
3311
+ return bytes.toString("hex");
3312
+ }
3313
+ /** `user@host`, as far as the machine will say. */
3314
+ function owner() {
3315
+ let user = "gkm";
3316
+ try {
3317
+ user = userInfo().username;
3318
+ } catch {}
3319
+ return `${user}@${hostname()}`;
3320
+ }
3321
+ //#endregion
2971
3322
  //#region src/reconcile/clients.ts
2972
3323
  /**
2973
3324
  * The real Postgres and MinIO clients the applier runs against.
@@ -3200,16 +3551,6 @@ const dockerCli = {
3200
3551
  if (options.show) return shown(args, services);
3201
3552
  await run("docker", args);
3202
3553
  },
3203
- async copyOut(composePath, service, from, to) {
3204
- await mkdir(dirname(to), { recursive: true });
3205
- await run("docker", [
3206
- "compose",
3207
- ...composeFiles(composePath),
3208
- "cp",
3209
- `${service}:${from}`,
3210
- to
3211
- ]);
3212
- },
3213
3554
  async reload(composePath, service) {
3214
3555
  await run("docker", [
3215
3556
  "compose",
@@ -3220,7 +3561,8 @@ const dockerCli = {
3220
3561
  "caddy",
3221
3562
  "reload",
3222
3563
  "--config",
3223
- "/etc/caddy/Caddyfile"
3564
+ "/etc/caddy/Caddyfile",
3565
+ "--force"
3224
3566
  ]);
3225
3567
  },
3226
3568
  async exec(composePath, service, argv) {
@@ -3854,17 +4196,12 @@ const CHECKOUT_MOUNTS = ["caddy"];
3854
4196
  */
3855
4197
  const caddySitesPath = (stage) => `.gkm/caddy-sites/${stage}.caddy`;
3856
4198
  /**
3857
- * Where the local edge's root certificate is copied to.
3858
- *
3859
- * Exported so a process can be pointed at it without installing anything:
3860
- * `NODE_EXTRA_CA_CERTS` is the whole of the trust story for Node, and it needs
3861
- * no sudo. A browser is the case that still wants the root in the system store,
3862
- * which is a one-time `caddy trust` rather than something a reconcile should do
3863
- * on a developer's behalf.
4199
+ * Where one stage's certificate is kept: certificate and key in one PEM,
4200
+ * issued from gkm's local authority (`trust/authority.ts`), beside the
4201
+ * stage's routes — so the edge reads it through the mount it already has, and
4202
+ * a stage removed takes its certificate with it.
3864
4203
  */
3865
- const LOCAL_CA_PATH = ".gkm/caddy-root.crt";
3866
- /** Where Caddy keeps the root of the CA it generated. */
3867
- const CADDY_ROOT_IN_CONTAINER = "/data/caddy/pki/authorities/local/root.crt";
4204
+ const caddyCertificatePath = (stage) => `.gkm/caddy-sites/${stage}.pem`;
3868
4205
  /**
3869
4206
  * Converge the local target on what the manifest declares.
3870
4207
  *
@@ -3907,7 +4244,10 @@ async function reconcile(options) {
3907
4244
  ...options.objectWebhooks?.length ? { objectWebhooks: options.objectWebhooks } : {},
3908
4245
  ...options.inboxRelay ? { inboxRelay: options.inboxRelay } : {}
3909
4246
  });
3910
- const caddyfile = toCaddyfile(sitesFor(plan, project, options.addresses, options.processorAddresses));
4247
+ const sites = sitesFor(plan, project, options.addresses, options.processorAddresses);
4248
+ const edged = plan.containers.includes("caddy");
4249
+ const authorityPaths = options.authority ?? localAuthorityPaths();
4250
+ const caddyfile = toCaddyfile(sites, { certificate: `${CADDY_SITES_IN_CONTAINER}/${stage}.pem` });
3911
4251
  const hash = planHash(plan, compose, {
3912
4252
  caddyfile,
3913
4253
  postgres: postgresStatements(plan, project, seed).map((statement) => statement.create).join(";\n")
@@ -3930,7 +4270,7 @@ async function reconcile(options) {
3930
4270
  uses: false,
3931
4271
  serviceName: project
3932
4272
  });
3933
- if (plan.containers.includes("caddy")) env.NODE_EXTRA_CA_CERTS = join(root, LOCAL_CA_PATH);
4273
+ if (edged) env.NODE_EXTRA_CA_CERTS = authorityPaths.certFile;
3934
4274
  return env;
3935
4275
  };
3936
4276
  const result = {
@@ -3948,11 +4288,12 @@ async function reconcile(options) {
3948
4288
  hash,
3949
4289
  changed: false
3950
4290
  };
4291
+ const certificate = edged ? await ensureLocalCertificate(await ensureLocalAuthority(authorityPaths), localCertificateNames(project, sites.map((site) => site.host)), join(root, caddyCertificatePath(stage))) : void 0;
3951
4292
  const recorded = await loadState(root, stage);
3952
4293
  const postgresPort = ports[primaryPortKey("postgres")];
3953
- if (recorded?.hash === hash && existsSync(composePath) && (!start || await docker.healthy(composePath, running, { mounted: CHECKOUT_MOUNTS })) && (!start || !provision || postgresPort === void 0 || await databasesExist(sql(postgresPort, options.credentials.postgres), postgresDatabaseNames(plan)))) return result;
4294
+ if (!certificate?.issued && recorded?.hash === hash && existsSync(composePath) && (!start || await docker.healthy(composePath, running, { mounted: CHECKOUT_MOUNTS })) && (!start || !provision || postgresPort === void 0 || await databasesExist(sql(postgresPort, options.credentials.postgres), postgresDatabaseNames(plan)))) return result;
3954
4295
  await write(composePath, toYaml(compose), 384);
3955
- if (plan.containers.includes("caddy")) {
4296
+ if (edged) {
3956
4297
  await write(join(root, CADDYFILE_PATH), caddyfileRoot());
3957
4298
  await write(join(root, caddySitesPath(stage)), caddyfile);
3958
4299
  await pruneCaddySites(root, [
@@ -3965,8 +4306,7 @@ async function reconcile(options) {
3965
4306
  options.progress?.(`🐳 Starting ${running.join(", ")} — the first start pulls each image, which can take a few minutes`);
3966
4307
  await docker.up(composePath, running, options.progress ? { show: true } : {});
3967
4308
  }
3968
- if (start && plan.containers.includes("caddy")) await docker.reload(composePath, "caddy").catch(() => {});
3969
- if (start && plan.containers.includes("caddy")) await docker.copyOut(composePath, "caddy", CADDY_ROOT_IN_CONTAINER, join(root, LOCAL_CA_PATH)).catch(() => {});
4309
+ if (start && edged) await docker.reload(composePath, "caddy").catch(() => {});
3970
4310
  const checked = start && plan.containers.length > 0 ? await logins({
3971
4311
  credentials: options.credentials,
3972
4312
  containers: plan.containers,
@@ -4051,8 +4391,8 @@ async function observedPorts(docker, composePath, containers, fakes) {
4051
4391
  */
4052
4392
  async function pruneCaddySites(root, stages) {
4053
4393
  const dir = dirname(join(root, caddySitesPath(TEST_STAGE)));
4054
- const keep = new Set(stages.map((stage) => stage && `${stage}.caddy`));
4055
- for (const file of await readdir(dir)) if (file.endsWith(".caddy") && !keep.has(file)) await rm(join(dir, file));
4394
+ const keep = new Set(stages.flatMap((stage) => stage ? [`${stage}.caddy`, `${stage}.pem`] : []));
4395
+ for (const file of await readdir(dir)) if (/\.(caddy|pem)$/.test(file) && !keep.has(file)) await rm(join(dir, file));
4056
4396
  }
4057
4397
  async function write(path, content, mode) {
4058
4398
  try {
@@ -4588,6 +4928,6 @@ function healthcheck(port, path) {
4588
4928
  };
4589
4929
  }
4590
4930
  //#endregion
4591
- export { mergeLifecycle as $, generateNextjsDockerfile as A, processorUnitName as B, TURBO_VERSION as C, generateBackendDockerfile as D, findBuildRoot as E, resolveDockerConfig as F, applyNotifications as G, workerUnits as H, imageBuildCredentials as I, bucketLifecycles as J, applyPolicies as K, isImageBuild as L, generateProcessorDockerfile as M, generateViteStaticDockerfile as N, generateDockerignore as O, generateWorkerDockerfile as P, quoteIdentifier as Q, publicBuildValues as R, PROCESSOR_PORT as S, detectPackageManager as T, applyBuckets as U, processorUnits as V, applyLifecycles as W, postgresDatabaseNames as X, bucketPolicies as Y, postgresStatements as Z, bucketClient as _, workerEnvKeys as a, resourceName as at, composeBuildPaths as b, constructGlobs as c, scopeTelemetryEnv as ct, workspace_exports as d, telemetryOf as dt, envFor as et, COMPOSE_PATH as f, usesTelemetry as ft, ensurePostgresLogin as g, LEGACY_LOCAL_LOGIN as h, PROCESSORS_DEV_PREFIX as ht, processorEnvKeys as i, planFor as it, generateNodeWebDockerfile as j, generateEntryDockerfile as k, derivedContainers as l, siteClientTelemetry as lt, forgetState as m, hostFor$1 as mt, dockerfileOf as n, stageEnv as nt, FAKE_ENV as o, appTelemetry as ot, LOCAL_CA_PATH as p, LOCAL_TLD as pt, applyPostgres as q, networkEnv as r, TELEMETRY_CONTAINER as rt, backendsOf as s, isTelemetryKey as st, appEnvKeys as t, localRolePassword as tt, reconcileWorkspace as u, surfaceClientTraced as ut, pgClient as v, WORKER_PORT as w, imageLayout as x, appImageOptions as y, isUnder as z };
4931
+ export { bucketPolicies as $, findBuildRoot as A, imageBuildCredentials as B, appImageOptions as C, TURBO_VERSION as D, PROCESSOR_PORT as E, generateNodeWebDockerfile as F, processorUnits as G, publicBuildValues as H, generateProcessorDockerfile as I, applyLifecycles as J, workerUnits as K, generateViteStaticDockerfile as L, generateDockerignore as M, generateEntryDockerfile as N, WORKER_PORT as O, generateNextjsDockerfile as P, bucketLifecycles as Q, generateWorkerDockerfile as R, readLocalAuthority as S, imageLayout as T, isUnder as U, isImageBuild as V, processorUnitName as W, applyPolicies as X, applyNotifications as Y, applyPostgres as Z, pgClient as _, LOCAL_TLD as _t, workerEnvKeys as a, localRolePassword as at, localAuthorityPaths as b, constructGlobs as c, planFor as ct, workspace_exports as d, isTelemetryKey as dt, postgresDatabaseNames as et, COMPOSE_PATH as f, scopeTelemetryEnv as ft, bucketClient as g, usesTelemetry as gt, ensurePostgresLogin as h, telemetryOf as ht, processorEnvKeys as i, envFor as it, generateBackendDockerfile as j, detectPackageManager as k, derivedContainers as l, resourceName as lt, LEGACY_LOCAL_LOGIN as m, surfaceClientTraced as mt, dockerfileOf as n, quoteIdentifier as nt, FAKE_ENV as o, stageEnv as ot, forgetState as p, siteClientTelemetry as pt, applyBuckets as q, networkEnv as r, mergeLifecycle as rt, backendsOf as s, TELEMETRY_CONTAINER as st, appEnvKeys as t, postgresStatements as tt, reconcileWorkspace as u, appTelemetry as ut, ensureLocalAuthority as v, hostFor$1 as vt, composeBuildPaths as w, localCertificateNames as x, ensureLocalCertificate as y, PROCESSORS_DEV_PREFIX as yt, resolveDockerConfig as z };
4592
4932
 
4593
- //# sourceMappingURL=apps-Xrlvir2-.mjs.map
4933
+ //# sourceMappingURL=apps-DWALM-8s.mjs.map