@catladder/cli 0.0.0-test4 → 0.0.0-updatemongo6-52a2af91

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 (304) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +6 -3
  3. package/bin/catenv +3 -0
  4. package/bin/catladder +1 -1
  5. package/dist/apps/catenv/catenv.d.ts +5 -0
  6. package/dist/apps/catenv/catenv.js +143 -0
  7. package/dist/apps/catenv/catenv.js.map +1 -0
  8. package/dist/apps/cli/cli.d.ts +2 -0
  9. package/dist/apps/cli/cli.js +81 -0
  10. package/dist/apps/cli/cli.js.map +1 -0
  11. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  12. package/dist/apps/cli/commands/general/index.js +216 -0
  13. package/dist/apps/cli/commands/general/index.js.map +1 -0
  14. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  15. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  16. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  17. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  18. package/dist/apps/cli/commands/general/portForward.js +97 -0
  19. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  20. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  21. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  22. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  23. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  24. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
  25. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  26. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  27. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  28. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  29. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  30. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +121 -0
  31. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  32. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  33. package/dist/apps/cli/commands/mongodb/utils/index.js +178 -0
  34. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  35. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  36. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +137 -0
  37. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +4 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js +298 -0
  40. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  41. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
  42. package/dist/apps/cli/commands/project/commandCopyDB.js +80 -0
  43. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
  44. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  45. package/dist/apps/cli/commands/project/commandDeletePods.js +120 -0
  46. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  47. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  48. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  49. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  50. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  51. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  52. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  53. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  54. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  55. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  56. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  57. package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
  58. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  59. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  60. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  61. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  62. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
  63. package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
  64. package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
  65. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  66. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  67. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  68. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  69. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  70. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  71. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  72. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  73. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  74. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  75. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  77. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  78. package/dist/apps/cli/commands/project/commandOpenDashboard.js +85 -0
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  80. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  81. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  82. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  83. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  84. package/dist/apps/cli/commands/project/commandOpenGit.js +61 -0
  85. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  86. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  87. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  92. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  93. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  94. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  95. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  96. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  97. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  98. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  99. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  100. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  101. package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
  102. package/dist/apps/cli/commands/project/commandSetup.js +58 -0
  103. package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
  104. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  105. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  106. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  107. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  108. package/dist/apps/cli/commands/project/index.js +94 -0
  109. package/dist/apps/cli/commands/project/index.js.map +1 -0
  110. package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
  111. package/dist/apps/cli/commands/project/setup/index.js +103 -0
  112. package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
  113. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
  114. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
  115. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
  116. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
  117. package/dist/apps/cli/commands/project/setup/setupContext.js +74 -0
  118. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
  119. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
  120. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +133 -0
  121. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
  122. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  123. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  124. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  125. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  126. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  127. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  128. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  129. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
  130. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  131. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  132. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  133. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  134. package/dist/apps/cli/commands/shared/index.d.ts +3 -0
  135. package/dist/apps/cli/commands/shared/index.js +70 -0
  136. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  137. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  138. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  139. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  140. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  141. package/dist/apps/cli/config/writeConfig.js +106 -0
  142. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  143. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  144. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  145. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  146. package/dist/apps/cli/verify/index.d.ts +2 -0
  147. package/dist/apps/cli/verify/index.js +94 -0
  148. package/dist/apps/cli/verify/index.js.map +1 -0
  149. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  150. package/dist/apps/cli/verify/migration/fromv2.js +347 -0
  151. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  152. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  153. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  154. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  155. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  156. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  157. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  158. package/dist/catenv.d.ts +1 -0
  159. package/dist/catenv.js +15 -0
  160. package/dist/catenv.js.map +1 -0
  161. package/dist/cli.d.ts +1 -0
  162. package/dist/cli.js +15 -0
  163. package/dist/cli.js.map +1 -0
  164. package/dist/config/constants.d.ts +2 -0
  165. package/dist/config/constants.js +6 -0
  166. package/dist/config/constants.js.map +1 -0
  167. package/dist/config/getProjectConfig.d.ts +24 -0
  168. package/dist/config/getProjectConfig.js +259 -0
  169. package/dist/config/getProjectConfig.js.map +1 -0
  170. package/dist/k8sApi/index.d.ts +8 -0
  171. package/dist/k8sApi/index.js +29 -0
  172. package/dist/k8sApi/index.js.map +1 -0
  173. package/dist/packageInfos.d.ts +2 -0
  174. package/dist/packageInfos.js +6 -0
  175. package/dist/packageInfos.js.map +1 -0
  176. package/dist/tsconfig.tsbuildinfo +1 -0
  177. package/dist/types/types.d.ts +18 -0
  178. package/dist/types/types.js +3 -0
  179. package/dist/types/types.js.map +1 -0
  180. package/dist/utils/cluster.d.ts +3 -0
  181. package/dist/utils/cluster.js +73 -0
  182. package/dist/utils/cluster.js.map +1 -0
  183. package/dist/utils/editAsFile.d.ts +1 -0
  184. package/dist/utils/editAsFile.js +85 -0
  185. package/dist/utils/editAsFile.js.map +1 -0
  186. package/dist/utils/files.d.ts +2 -0
  187. package/dist/utils/files.js +83 -0
  188. package/dist/utils/files.js.map +1 -0
  189. package/dist/utils/getEditor.d.ts +4 -0
  190. package/dist/utils/getEditor.js +70 -0
  191. package/dist/utils/getEditor.js.map +1 -0
  192. package/dist/utils/gitlab.d.ts +22 -0
  193. package/dist/utils/gitlab.js +340 -0
  194. package/dist/utils/gitlab.js.map +1 -0
  195. package/dist/utils/log.d.ts +1 -0
  196. package/dist/utils/log.js +14 -0
  197. package/dist/utils/log.js.map +1 -0
  198. package/dist/utils/passwordstore/index.d.ts +7 -0
  199. package/dist/utils/passwordstore/index.js +315 -0
  200. package/dist/utils/passwordstore/index.js.map +1 -0
  201. package/dist/utils/portForward.d.ts +4 -0
  202. package/dist/utils/portForward.js +116 -0
  203. package/dist/utils/portForward.js.map +1 -0
  204. package/dist/utils/preferences/index.d.ts +3 -0
  205. package/dist/utils/preferences/index.js +119 -0
  206. package/dist/utils/preferences/index.js.map +1 -0
  207. package/dist/utils/projects/index.d.ts +8 -0
  208. package/dist/utils/projects/index.js +154 -0
  209. package/dist/utils/projects/index.js.map +1 -0
  210. package/dist/utils/promise.d.ts +2 -0
  211. package/dist/utils/promise.js +62 -0
  212. package/dist/utils/promise.js.map +1 -0
  213. package/dist/utils/shell.d.ts +1 -0
  214. package/dist/utils/shell.js +81 -0
  215. package/dist/utils/shell.js.map +1 -0
  216. package/package.json +17 -21
  217. package/src/apps/catenv/catenv.ts +55 -27
  218. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  219. package/src/apps/{shell → cli}/commands/general/index.ts +7 -46
  220. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  221. package/src/apps/{shell → cli}/commands/general/portForward.ts +3 -2
  222. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  223. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  224. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  225. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +62 -0
  226. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +26 -15
  227. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +88 -0
  228. package/src/apps/cli/commands/project/commandConfigSecrets.ts +200 -0
  229. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +25 -26
  230. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +10 -10
  231. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  232. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  233. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  234. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  235. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  236. package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +14 -6
  237. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  238. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  239. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  240. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  241. package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
  242. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  243. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
  244. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  245. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  246. package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
  247. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  248. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  249. package/src/apps/cli/commands/project/commandSetup.ts +12 -0
  250. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +10 -10
  251. package/src/apps/{shell → cli}/commands/project/index.ts +6 -7
  252. package/src/apps/cli/commands/project/setup/index.ts +42 -0
  253. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +73 -0
  254. package/src/apps/cli/commands/project/setup/setupContext.ts +37 -0
  255. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +113 -0
  256. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  257. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  258. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +56 -0
  259. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  260. package/src/apps/cli/commands/shared/index.ts +36 -0
  261. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
  262. package/src/apps/cli/config/writeConfig.ts +71 -0
  263. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  264. package/src/apps/cli/verify/index.ts +30 -0
  265. package/src/apps/cli/verify/migration/fromv2.ts +264 -0
  266. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  267. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  268. package/src/catenv.ts +11 -0
  269. package/src/cli.ts +9 -0
  270. package/src/config/constants.ts +0 -3
  271. package/src/config/getProjectConfig.ts +160 -0
  272. package/src/k8sApi/index.ts +22 -6
  273. package/src/types/types.ts +0 -2
  274. package/src/utils/cluster.ts +6 -15
  275. package/src/utils/editAsFile.ts +31 -0
  276. package/src/utils/files.ts +6 -2
  277. package/src/utils/gitlab.ts +212 -34
  278. package/src/utils/passwordstore/index.ts +4 -34
  279. package/src/utils/preferences/index.ts +6 -3
  280. package/src/utils/projects/index.ts +22 -138
  281. package/tsconfig.json +3 -7
  282. package/bin/catenv.sh +0 -1
  283. package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
  284. package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
  285. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  286. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  287. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  288. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  289. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  290. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  291. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  292. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  293. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  294. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  295. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  296. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  297. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  298. package/src/apps/shell/commands/shared/index.ts +0 -31
  299. package/src/config/clusters.ts +0 -45
  300. package/src/index.ts +0 -17
  301. package/src/types/git-repo-name.d.ts +0 -1
  302. package/src/types/yawn-yaml.d.ts +0 -1
  303. package/src/utils/dashboardToken.ts +0 -20
  304. package/src/utils/formatEnvVars.ts +0 -7
@@ -3,9 +3,9 @@ import Vorpal from "vorpal";
3
3
  import { logError } from "../../../../utils/log";
4
4
  import {
5
5
  getProjectNamespace,
6
- getProjectPvcs
6
+ getProjectPvcs,
7
7
  } from "../../../../utils/projects";
8
- import { envAutocompletion } from "../project/utils/autocompletions";
8
+ import { envAndComponents } from "../project/utils/autocompletions";
9
9
  import ensureCluster from "../project/utils/ensureCluster";
10
10
  import { getMongoDbPodsWithReplInfo } from "./utils";
11
11
 
@@ -31,18 +31,18 @@ const removeFinalizerAndDelete = async (
31
31
  ) => {
32
32
  return Promise.all([
33
33
  removeFinalizer(namespace, type, name),
34
- await deleteResource(namespace, type, name)
34
+ await deleteResource(namespace, type, name),
35
35
  ]);
36
36
  };
37
- export default (vorpal: Vorpal) =>
37
+ export default async (vorpal: Vorpal) =>
38
38
  vorpal
39
39
  .command(
40
- "project-mongo-destroy-member <env>",
40
+ "project-mongo-destroy-member <envComponent>",
41
41
  "DESTROY a member of a replicaset in order to reinitialize it"
42
42
  )
43
- .autocomplete(envAutocompletion)
44
- .action(async function({ env }) {
45
- await ensureCluster.call(this);
43
+ .autocomplete(await envAndComponents())
44
+ .action(async function ({ envComponent }) {
45
+ await ensureCluster.call(this, envComponent);
46
46
  this.log(
47
47
  "this command tries to delete a (secondary) member of the replicaset, it's persistent volume claim (pvc) and the volume"
48
48
  );
@@ -67,18 +67,18 @@ export default (vorpal: Vorpal) =>
67
67
  default: true,
68
68
  message: "DO YOU UNDERSTAND?",
69
69
  name: "understood",
70
- type: "confirm"
70
+ type: "confirm",
71
71
  });
72
72
 
73
73
  if (!understood) {
74
74
  throw new Error("abort");
75
75
  }
76
76
 
77
- const namespace = await getProjectNamespace(env);
78
- const mongodbPods = await getMongoDbPodsWithReplInfo(env);
77
+ const namespace = await getProjectNamespace(envComponent);
78
+ const mongodbPods = await getMongoDbPodsWithReplInfo(envComponent);
79
79
 
80
- const pvcs = await getProjectPvcs(env);
81
- const secondaries = mongodbPods.filter(pod => !pod.isMaster);
80
+ const pvcs = await getProjectPvcs(envComponent);
81
+ const secondaries = mongodbPods.filter((pod) => !pod.isMaster);
82
82
 
83
83
  if (secondaries.length === 0) {
84
84
  logError(this, "sorry, no pods found");
@@ -89,16 +89,16 @@ export default (vorpal: Vorpal) =>
89
89
  await this.prompt({
90
90
  type: "list",
91
91
  name: "podName",
92
- choices: secondaries.map(p => ({
92
+ choices: secondaries.map((p) => ({
93
93
  name: `[ secondary ] ${p.podName}`,
94
- value: p.podName
94
+ value: p.podName,
95
95
  })),
96
- message: "Which pod? 🤔"
96
+ message: "Which pod? 🤔",
97
97
  })
98
98
  ).podName;
99
99
 
100
100
  const thePvc = pvcs.find(
101
- pvc => pvc.metadata.name === `datadir-${podName}`
101
+ (pvc) => pvc.metadata.name === `datadir-${podName}`
102
102
  );
103
103
  if (!thePvc) {
104
104
  logError(this, `sorry, no pvc found for ${podName}`);
@@ -109,7 +109,7 @@ export default (vorpal: Vorpal) =>
109
109
  message:
110
110
  "THIS WILL DESTROY THE POD, ITS VOLUME AND ALL ITS DATA 🙀🙀🙀!!! continue? 🤔",
111
111
  name: "shouldContinue",
112
- type: "confirm"
112
+ type: "confirm",
113
113
  });
114
114
 
115
115
  if (!shouldContinue) {
@@ -1,24 +1,26 @@
1
1
  import Vorpal from "vorpal";
2
2
  import { logError } from "../../../../utils/log";
3
3
  import { getProjectNamespace } from "../../../../utils/projects";
4
- import { envAutocompletion } from "../project/utils/autocompletions";
4
+ import { envAndComponents } from "../project/utils/autocompletions";
5
5
  import ensureCluster from "../project/utils/ensureCluster";
6
6
  import {
7
7
  getMongodbShell,
8
- getProjectMongodbAllPodsSortedWithLabel
8
+ getProjectMongodbAllPodsSortedWithLabel,
9
9
  } from "./utils";
10
10
 
11
- export default (vorpal: Vorpal) =>
11
+ export default async (vorpal: Vorpal) =>
12
12
  vorpal
13
13
  .command(
14
- "project-mongo-get-shell <env>",
14
+ "project-mongo-get-shell <envComponent>",
15
15
  "get a shell to a mongodb in the environment"
16
16
  )
17
- .autocomplete(envAutocompletion)
18
- .action(async function({ env }) {
19
- await ensureCluster.call(this);
20
- const namespace = await getProjectNamespace(env);
21
- const podNames = await getProjectMongodbAllPodsSortedWithLabel(env);
17
+ .autocomplete(await envAndComponents())
18
+ .action(async function ({ envComponent }) {
19
+ await ensureCluster.call(this, envComponent);
20
+ const namespace = await getProjectNamespace(envComponent);
21
+ const podNames = await getProjectMongodbAllPodsSortedWithLabel(
22
+ envComponent
23
+ );
22
24
  if (podNames.length === 0) {
23
25
  logError(this, "sorry, no pods found");
24
26
  return;
@@ -32,7 +34,7 @@ export default (vorpal: Vorpal) =>
32
34
  type: "list",
33
35
  name: "podName",
34
36
  choices: podNames,
35
- message: "Which pod? 🤔"
37
+ message: "Which pod? 🤔",
36
38
  })
37
39
  ).podName;
38
40
  }
@@ -0,0 +1,62 @@
1
+ import Vorpal from "vorpal";
2
+ import { getEnvVars, parseChoice } from "../../../../config/getProjectConfig";
3
+ import { logError } from "../../../../utils/log";
4
+ import { startPortForward } from "../../../../utils/portForward";
5
+ import { getProjectNamespace } from "../../../../utils/projects";
6
+ import { envAndComponents } from "../project/utils/autocompletions";
7
+ import ensureCluster from "../project/utils/ensureCluster";
8
+ import { getProjectMongodbAllPodsSortedWithLabel } from "./utils";
9
+ import clipboard from "clipboardy";
10
+
11
+ export default async (vorpal: Vorpal) =>
12
+ vorpal
13
+ .command(
14
+ "project-mongo-port-forward <envComponent>",
15
+ "port foward to a mongodb"
16
+ )
17
+ .autocomplete(await envAndComponents())
18
+ .action(async function ({ envComponent }) {
19
+ await ensureCluster.call(this, envComponent);
20
+ const namespace = await getProjectNamespace(envComponent);
21
+ const podNames = await getProjectMongodbAllPodsSortedWithLabel(
22
+ envComponent
23
+ );
24
+ if (podNames.length === 0) {
25
+ logError(this, "sorry, no pods found");
26
+ return;
27
+ }
28
+ let podName;
29
+ if (podNames.length === 1) {
30
+ podName = podNames[0].value;
31
+ } else {
32
+ podName = (
33
+ await this.prompt({
34
+ type: "list",
35
+ name: "podName",
36
+ choices: podNames,
37
+ message: "Which pod? 🤔",
38
+ })
39
+ ).podName;
40
+ }
41
+
42
+ const { localPort } = await this.prompt({
43
+ type: "number",
44
+ name: "localPort",
45
+ default: "30000",
46
+ message: "Local port: ",
47
+ });
48
+ const { env, componentName } = parseChoice(envComponent);
49
+ const envVars = await getEnvVars(this, env, componentName);
50
+ const MONGODB_ROOT_PASSWORD = envVars?.MONGODB_ROOT_PASSWORD;
51
+ const connectionUrl = `mongodb://root:${MONGODB_ROOT_PASSWORD}@localhost:${localPort}`;
52
+ clipboard.writeSync(connectionUrl);
53
+ this.log("");
54
+ this.log("username: root");
55
+ this.log(`password: ${MONGODB_ROOT_PASSWORD}`);
56
+ this.log(`connection string: ${connectionUrl}`);
57
+ this.log("");
58
+ this.log("👆 connection string has been copied to your clipboard!");
59
+ this.log("");
60
+
61
+ return startPortForward(podName, localPort, 27017, namespace);
62
+ });
@@ -1,15 +1,19 @@
1
1
  import { exec, spawn } from "child-process-promise";
2
- import { Env } from "../../../../../types/types";
3
2
  import {
4
3
  getProjectNamespace,
5
4
  getProjectPodNames,
6
5
  } from "../../../../../utils/projects";
7
6
 
8
7
  const filterMongoDbs = (podNames: string[]) =>
9
- podNames.filter((name) => name.includes("mongodb-replicaset"));
8
+ podNames.filter(
9
+ (name) =>
10
+ name.includes("mongodb") &&
11
+ !name.includes("mongodb-backup") &&
12
+ !name.includes("arbiter")
13
+ );
10
14
 
11
- export const getProjectMongodbAllPods = async (env: Env) =>
12
- filterMongoDbs(await getProjectPodNames(env));
15
+ export const getProjectMongodbAllPods = async (envComponent: string) =>
16
+ filterMongoDbs(await getProjectPodNames(envComponent));
13
17
 
14
18
  export const getMongodbShell = async (namespace: string, podName: string) => {
15
19
  const command = `kubectl exec -it ${podName} --namespace ${namespace} mongo`;
@@ -44,23 +48,28 @@ export const executeMongodbCommand = async (
44
48
  };
45
49
 
46
50
  export const podIsMaster = async (namespace: string, podName: string) => {
47
- const result = await executeMongodbCommand(
48
- namespace,
49
- podName,
50
- "db.isMaster()"
51
- );
51
+ try {
52
+ const result = await executeMongodbCommand(
53
+ namespace,
54
+ podName,
55
+ "db.isMaster()"
56
+ );
52
57
 
53
- return result.ismaster;
58
+ return result.ismaster;
59
+ } catch (e) {
60
+ // maybe shutting down ?
61
+ return null;
62
+ }
54
63
  };
55
64
 
56
65
  const spaces = (n: number) => " ".repeat(n);
57
66
 
58
- export const getMongoDbPodsWithReplInfo = async (env: Env) => {
59
- const namespace = await getProjectNamespace(env);
67
+ export const getMongoDbPodsWithReplInfo = async (envComponent: string) => {
68
+ const namespace = await getProjectNamespace(envComponent);
60
69
  return (
61
70
  await Promise.all(
62
71
  (
63
- await getProjectMongodbAllPods(env)
72
+ await getProjectMongodbAllPods(envComponent)
64
73
  ).map(async (podName) => ({
65
74
  podName,
66
75
  componentName: podName.replace(/-mongodb-replicaset-[0-9]+/, ""),
@@ -70,8 +79,10 @@ export const getMongoDbPodsWithReplInfo = async (env: Env) => {
70
79
  ).sort((podA, podB) => (podA.isMaster ? (podB.isMaster ? 0 : -1) : 1));
71
80
  };
72
81
 
73
- export const getProjectMongodbAllPodsSortedWithLabel = async (env: Env) => {
74
- const pods = await getMongoDbPodsWithReplInfo(env);
82
+ export const getProjectMongodbAllPodsSortedWithLabel = async (
83
+ envComponent: string
84
+ ) => {
85
+ const pods = await getMongoDbPodsWithReplInfo(envComponent);
75
86
  const maxComponentNameLength = Math.max(
76
87
  ...pods.map((c) => c.componentName.length)
77
88
  );
@@ -0,0 +1,88 @@
1
+ import { isOfDeployType } from "@catladder/pipeline";
2
+ import { spawn } from "child-process-promise";
3
+ import { writeFile } from "fs-extra";
4
+ import { withFile } from "tmp-promise";
5
+ import Vorpal from "vorpal";
6
+ import {
7
+ getEnvVars,
8
+ getGitlabVar,
9
+ getPipelineContextByChoice,
10
+ getProjectConfig,
11
+ parseChoice,
12
+ } from "../../../../config/getProjectConfig";
13
+ import { envAndComponents } from "./utils/autocompletions";
14
+
15
+ export default async (vorpal: Vorpal) =>
16
+ vorpal
17
+ .command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db")
18
+ .autocomplete(await envAndComponents())
19
+ .action(async function ({ envComponent }) {
20
+ const { env, componentName } = parseChoice(envComponent);
21
+
22
+ const config = await getProjectConfig();
23
+ // skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
24
+
25
+ const { localPort } = await this.prompt({
26
+ type: "number",
27
+ name: "localPort",
28
+ default: "54320",
29
+ message: "Local port: ",
30
+ });
31
+
32
+ const envVars = await getEnvVars(this, env, componentName);
33
+ const POSTGRESQL_PASSWORD = envVars?.POSTGRESQL_PASSWORD;
34
+
35
+ const context = await getPipelineContextByChoice(env, componentName);
36
+ if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
37
+ throw new Error("currently only supported for kubernetes deployment");
38
+ }
39
+ this.log("");
40
+ this.log(`postgres-PW: ${POSTGRESQL_PASSWORD}`);
41
+ this.log("");
42
+ this.log(
43
+ `POSTGRESQL_URL=postgresql://postgres:${POSTGRESQL_PASSWORD}@localhost:${localPort}/${context.environment.envVars.KUBE_APP_NAME}?schema=public`
44
+ );
45
+ this.log("");
46
+
47
+ const values = context.componentConfig.deploy.values;
48
+
49
+ const projectId =
50
+ values?.cloudsql?.projectId ||
51
+ context.componentConfig.deploy.cluster?.projectId;
52
+
53
+ const defaultInstanceId = `${config.customerName}-${config.appName}-${env}`;
54
+ const instanceId = values?.cloudsql?.instanceId || defaultInstanceId;
55
+
56
+ const defaultRegion = "europe-west6"; // currently hardcoded
57
+ const region = values?.cloudsql?.region || defaultRegion;
58
+
59
+ const instanceName = `${projectId}:${region}:${instanceId}=tcp:${localPort}`;
60
+
61
+ const cloudsqlProxyCredentials = await getGitlabVar(
62
+ this,
63
+ env,
64
+ componentName,
65
+ "cloudsqlProxyCredentials"
66
+ );
67
+
68
+ if (!cloudsqlProxyCredentials) {
69
+ // we store cloudsqlProxyCredentials on gitlab, but its currently get pushed via bitwarden due to legacy reasons
70
+ // this will be fixed with when https://git.panter.ch/catladder/catladder/-/merge_requests/32/ is merged
71
+ this.log(
72
+ "cloudsqlProxyCredentials env var missing in gitlab. Please contact gilde-ci-cd about that."
73
+ );
74
+ throw new Error("cloudsqlProxyCredentials missing in secrets");
75
+ }
76
+ await withFile(async ({ path: tmpFilePath }) => {
77
+ await writeFile(tmpFilePath, cloudsqlProxyCredentials);
78
+
79
+ await spawn(
80
+ "cloud_sql_proxy",
81
+ ["-instances", instanceName, "-credential_file", tmpFilePath],
82
+ {
83
+ stdio: "inherit",
84
+ shell: true,
85
+ }
86
+ );
87
+ });
88
+ });
@@ -0,0 +1,200 @@
1
+ /* eslint-disable no-constant-condition */
2
+ import { getSecretVarName } from "@catladder/pipeline";
3
+ import { stripIndents } from "common-tags";
4
+ import { difference } from "lodash";
5
+ import Vorpal, { CommandInstance } from "vorpal";
6
+ import {
7
+ getAllComponentsWithAllEnvsHierarchical,
8
+ getEnvironment,
9
+ getEnvVars,
10
+ getProjectComponents,
11
+ parseChoice,
12
+ } from "../../../../config/getProjectConfig";
13
+ import { editAsFile } from "../../../../utils/editAsFile";
14
+ import { upsertAllVariables } from "../../../../utils/gitlab";
15
+ import { delay } from "../../../../utils/promise";
16
+ import { allEnvsAndAllComponents } from "./utils/autocompletions";
17
+
18
+ type Vars = {
19
+ [env: string]: {
20
+ [componentName: string]: Record<string, string>;
21
+ };
22
+ };
23
+ /* for convenience, parse json objects. that makes it easier to edit secrets that are object */
24
+ const resolveJson = (v: Vars) =>
25
+ Object.fromEntries(
26
+ Object.entries(v).map(([componentName, envs]) => {
27
+ return [
28
+ componentName,
29
+ Object.fromEntries(
30
+ Object.entries(envs).map(([env, secrets]) => [
31
+ env,
32
+ Object.fromEntries(
33
+ Object.entries(secrets).map(([key, value]) => {
34
+ try {
35
+ return [key, JSON.parse(value)];
36
+ } catch (e) {
37
+ return [key, value];
38
+ }
39
+ })
40
+ ),
41
+ ])
42
+ ),
43
+ ];
44
+ })
45
+ );
46
+
47
+ const getEnvVarsToEdit = async (
48
+ instance: CommandInstance,
49
+ env: string,
50
+ componentName: string
51
+ ) => {
52
+ const { secretEnvVarKeys } = await getEnvironment(env, componentName);
53
+
54
+ const allEnvVars = await getEnvVars(instance, env, componentName);
55
+ return Object.fromEntries(
56
+ secretEnvVarKeys.map((key) => {
57
+ const value = allEnvVars[key];
58
+ // due to some quirky way to resolve these variables, unset variables have the $CL_ prefix, so we remove thouse here
59
+ const variableIsNotSet =
60
+ value === "$" + getSecretVarName(env, componentName, key);
61
+ return [key, variableIsNotSet ? "🚨 FILL ME" : value];
62
+ })
63
+ );
64
+ };
65
+ const doItFor = async (
66
+ instance: CommandInstance,
67
+ envAndComponents: {
68
+ [componentName: string]: string[];
69
+ }
70
+ ) => {
71
+ let valuesToEdit: Vars = Object.fromEntries(
72
+ await Promise.all(
73
+ Object.entries(envAndComponents).map(async ([componentName, envs]) => [
74
+ componentName,
75
+ Object.fromEntries(
76
+ await Promise.all(
77
+ envs.map(async (env) => [
78
+ env,
79
+ await getEnvVarsToEdit(instance, env, componentName),
80
+ ])
81
+ )
82
+ ),
83
+ ])
84
+ )
85
+ );
86
+ let hasErrors = true;
87
+ while (hasErrors) {
88
+ valuesToEdit = await editAsFile(
89
+ resolveJson(valuesToEdit),
90
+ stripIndents`
91
+ Please fill in all secrets for:
92
+
93
+ ${Object.entries(envAndComponents)
94
+ .map(
95
+ ([componentName, envs]) => `- ${componentName}: ${envs.join(", ")}`
96
+ )
97
+ .join("\n")}
98
+
99
+ `
100
+ );
101
+ // check for errors
102
+ hasErrors = false;
103
+ for (const [componentName, envs] of Object.entries(envAndComponents)) {
104
+ for (const env of envs) {
105
+ const usedKeys = valuesToEdit[componentName][env]
106
+ ? Object.keys(valuesToEdit[componentName][env])
107
+ : [];
108
+ // check whether newValues have the exact number of keys
109
+ const { secretEnvVarKeys } = await getEnvironment(env, componentName);
110
+ const extranous = difference(usedKeys, secretEnvVarKeys);
111
+ const missing = difference(secretEnvVarKeys, usedKeys);
112
+
113
+ if (extranous.length > 0 || missing.length > 0) {
114
+ instance.log("");
115
+ instance.log(
116
+ `😿 Oh no! There is something wrong with "${componentName}"`
117
+ );
118
+ instance.log("");
119
+ if (extranous.length > 0) {
120
+ instance.log("these secrets are not declared in the config");
121
+ extranous.forEach((key) => instance.log(key));
122
+ instance.log("");
123
+ }
124
+ if (missing.length > 0) {
125
+ instance.log("these secrets have not been provided:");
126
+ missing.forEach((key) => instance.log(key));
127
+ instance.log("");
128
+ }
129
+
130
+ await delay(1000);
131
+ const { shouldContinue } = await instance.prompt({
132
+ default: true,
133
+ message: "Try again? 🤔",
134
+ name: "shouldContinue",
135
+ type: "confirm",
136
+ });
137
+
138
+ if (!shouldContinue) {
139
+ throw new Error("abort");
140
+ }
141
+ hasErrors = true;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ instance.log("upserting all variables, please wait...");
147
+ instance.log("");
148
+ for (const [componentName, envs] of Object.entries(envAndComponents)) {
149
+ for (const env of envs) {
150
+ await upsertAllVariables(
151
+ instance,
152
+ valuesToEdit[componentName][env],
153
+ env,
154
+ componentName
155
+ );
156
+ instance.log("");
157
+ instance.log("✅ " + env + ":" + componentName);
158
+ }
159
+ }
160
+ instance.log("done! 😻");
161
+ instance.log("");
162
+ };
163
+
164
+ export const projectConfigSecrets = async (
165
+ vorpal: CommandInstance,
166
+ envComponent?: string
167
+ ) => {
168
+ if (!envComponent) {
169
+ const allEnvAndcomponents = await getAllComponentsWithAllEnvsHierarchical();
170
+ await doItFor(vorpal, allEnvAndcomponents);
171
+ } else {
172
+ const { env, componentName } = parseChoice(envComponent);
173
+
174
+ // componentName can be null. in this case, iterate over all components
175
+ if (!componentName) {
176
+ const components = await getProjectComponents();
177
+ await doItFor(
178
+ vorpal,
179
+ Object.fromEntries(components.map((c) => [c, [env]]))
180
+ );
181
+ }
182
+ if (componentName) {
183
+ await doItFor(vorpal, {
184
+ [componentName]: [env],
185
+ });
186
+ }
187
+ }
188
+ };
189
+
190
+ export default async (vorpal: Vorpal) => {
191
+ vorpal
192
+ .command(
193
+ "project-config-secrets [envComponent]",
194
+ "setup/update secrets stored in pass"
195
+ )
196
+ .autocomplete(await allEnvsAndAllComponents())
197
+ .action(async function ({ envComponent }) {
198
+ return await projectConfigSecrets(this, envComponent);
199
+ });
200
+ };
@@ -1,27 +1,23 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import Vorpal from "vorpal";
3
3
  import {
4
- GOOGLE_CLOUD_SQL_PASS_PATH,
5
- GOOGLE_PROJECT,
6
- } from "../../../../config/constants";
4
+ getEnvVars,
5
+ getProjectConfig,
6
+ parseChoice,
7
+ } from "../../../../config/getProjectConfig";
7
8
  import { readPass } from "../../../../utils/passwordstore";
8
- import {
9
- getAllEnvVars,
10
- getLocalProjectVariables,
11
- } from "../../../../utils/projects";
12
- import { envAutocompletion } from "./utils/autocompletions";
13
- import { promptForSubAppIfAny } from "./utils/monorepo";
9
+ import { envAndComponents } from "./utils/autocompletions";
14
10
 
15
- export default (vorpal: Vorpal) =>
11
+ export default async (vorpal: Vorpal) =>
16
12
  vorpal
17
- .command("copy-db <env>", "replace local db with the one from an env")
18
- .autocomplete(envAutocompletion)
19
- .action(async function copyDB({ env }) {
20
- const {
21
- CUSTOMER_NAME,
22
- APP_NAME,
23
- COMPONENT_NAME = "web",
24
- } = await getLocalProjectVariables();
13
+ .command(
14
+ "copy-db <envComponent>",
15
+ "replace local db with the one from an env"
16
+ )
17
+ .autocomplete(await envAndComponents())
18
+ .action(async function copyDB({ envComponent }) {
19
+ const { env, componentName } = parseChoice(envComponent);
20
+ const { customerName, appName } = await getProjectConfig();
25
21
 
26
22
  const { shouldContinue } = await this.prompt({
27
23
  type: "confirm",
@@ -34,15 +30,19 @@ export default (vorpal: Vorpal) =>
34
30
  return;
35
31
  }
36
32
 
37
- const subapp = await promptForSubAppIfAny(this);
38
-
33
+ // TODO: reimpleent with new config
34
+ /*
35
+ throw new Error("needs reimplementation with new config");
39
36
  const GOOGLE_CLOUD_SQL_REGION = "europe-west6"; // currently hardcoded
40
- const POSTGRESQL_PASSWORD = (await getAllEnvVars(env, subapp))
41
- ?.POSTGRESQL_PASSWORD;
37
+ const { POSTGRESQL_PASSWORD } = await getEnvVars(
38
+ this,
39
+ env,
40
+ componentName
41
+ );
42
42
 
43
43
  const LOCAL_PORT = 54321;
44
44
 
45
- const instanceName = `${GOOGLE_PROJECT}:${GOOGLE_CLOUD_SQL_REGION}:${CUSTOMER_NAME}-${APP_NAME}-${env}=tcp:${LOCAL_PORT}`;
45
+ const instanceName = `${"xxxxxx reimplement shoulld be project id"}:${GOOGLE_CLOUD_SQL_REGION}:${customerName}-${appName}-${env}=tcp:${LOCAL_PORT}`;
46
46
  const cloudsqlCredentials = await readPass(GOOGLE_CLOUD_SQL_PASS_PATH);
47
47
 
48
48
  const { POSTGRESQL_URL } = process.env;
@@ -72,9 +72,7 @@ export default (vorpal: Vorpal) =>
72
72
  dumptmp=$(mktemp /tmp/dump.XXXXXX)
73
73
 
74
74
  echo "Dumping file to $dumptmp"
75
- pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${
76
- subapp ?? COMPONENT_NAME
77
- } --no-owner --no-privileges > $dumptmp
75
+ pg_dump --dbname=postgres://postgres:${POSTGRESQL_PASSWORD}@localhost:${LOCAL_PORT}/${componentName} --no-owner --no-privileges > $dumptmp
78
76
  psql -q -c "drop database ${localDBName}" 1> /dev/null
79
77
  psql -q -c "create database ${localDBName}" 1> /dev/null
80
78
  echo "Restoring dump..."
@@ -90,4 +88,5 @@ export default (vorpal: Vorpal) =>
90
88
  `;
91
89
 
92
90
  await spawn(copyDBScript, [], { shell: "bash", stdio: "inherit" });
91
+ */
93
92
  });