@catladder/cli 0.0.0-test3 → 0.0.0-yarnrc-support-bdbef31f

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 (292) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +4 -2
  3. package/bin/catenv +3 -0
  4. package/bin/catladder +1 -1
  5. package/dist/apps/catenv/catenv.d.ts +2 -0
  6. package/dist/apps/catenv/catenv.js +135 -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 +208 -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 +98 -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 +105 -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 +167 -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 +129 -0
  37. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js +294 -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 +102 -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 +119 -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/commandInitGitlab.d.ts +3 -0
  63. package/dist/apps/cli/commands/project/commandInitGitlab.js +136 -0
  64. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
  65. package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
  66. package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
  67. package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
  68. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  69. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  70. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  71. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  73. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  74. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  75. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  76. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  79. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js +85 -0
  82. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  83. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  84. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  85. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  86. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  87. package/dist/apps/cli/commands/project/commandOpenGit.js +61 -0
  88. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  92. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  93. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  94. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  95. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  96. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  97. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  98. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  99. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  100. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  101. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  102. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  103. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  104. package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +3 -0
  105. package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
  106. package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
  107. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  108. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  109. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  110. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  111. package/dist/apps/cli/commands/project/index.js +97 -0
  112. package/dist/apps/cli/commands/project/index.js.map +1 -0
  113. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  114. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  115. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  116. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  117. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  118. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  119. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  120. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +106 -0
  121. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  122. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  123. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  124. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  125. package/dist/apps/cli/commands/shared/index.d.ts +3 -0
  126. package/dist/apps/cli/commands/shared/index.js +70 -0
  127. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  128. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  130. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  131. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  132. package/dist/apps/cli/config/writeConfig.js +106 -0
  133. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  134. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  135. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  136. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  137. package/dist/apps/cli/verify/index.d.ts +2 -0
  138. package/dist/apps/cli/verify/index.js +94 -0
  139. package/dist/apps/cli/verify/index.js.map +1 -0
  140. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  141. package/dist/apps/cli/verify/migration/fromv2.js +345 -0
  142. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  143. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  144. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  145. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  146. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  147. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  148. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  149. package/dist/catenv.d.ts +1 -0
  150. package/dist/catenv.js +10 -0
  151. package/dist/catenv.js.map +1 -0
  152. package/dist/cli.d.ts +1 -0
  153. package/dist/cli.js +15 -0
  154. package/dist/cli.js.map +1 -0
  155. package/dist/config/constants.d.ts +3 -0
  156. package/dist/config/constants.js +7 -0
  157. package/dist/config/constants.js.map +1 -0
  158. package/dist/config/getProjectConfig.d.ts +24 -0
  159. package/dist/config/getProjectConfig.js +232 -0
  160. package/dist/config/getProjectConfig.js.map +1 -0
  161. package/dist/k8sApi/index.d.ts +6 -0
  162. package/dist/k8sApi/index.js +15 -0
  163. package/dist/k8sApi/index.js.map +1 -0
  164. package/dist/packageInfos.d.ts +2 -0
  165. package/dist/packageInfos.js +6 -0
  166. package/dist/packageInfos.js.map +1 -0
  167. package/dist/tsconfig.tsbuildinfo +1 -0
  168. package/dist/types/types.d.ts +18 -0
  169. package/dist/types/types.js +3 -0
  170. package/dist/types/types.js.map +1 -0
  171. package/dist/utils/cluster.d.ts +3 -0
  172. package/dist/utils/cluster.js +75 -0
  173. package/dist/utils/cluster.js.map +1 -0
  174. package/dist/utils/editAsFile.d.ts +1 -0
  175. package/dist/utils/editAsFile.js +85 -0
  176. package/dist/utils/editAsFile.js.map +1 -0
  177. package/dist/utils/files.d.ts +2 -0
  178. package/dist/utils/files.js +83 -0
  179. package/dist/utils/files.js.map +1 -0
  180. package/dist/utils/formatEnvVars.d.ts +2 -0
  181. package/dist/utils/formatEnvVars.js +10 -0
  182. package/dist/utils/formatEnvVars.js.map +1 -0
  183. package/dist/utils/getEditor.d.ts +4 -0
  184. package/dist/utils/getEditor.js +70 -0
  185. package/dist/utils/getEditor.js.map +1 -0
  186. package/dist/utils/gitlab.d.ts +21 -0
  187. package/dist/utils/gitlab.js +262 -0
  188. package/dist/utils/gitlab.js.map +1 -0
  189. package/dist/utils/log.d.ts +1 -0
  190. package/dist/utils/log.js +14 -0
  191. package/dist/utils/log.js.map +1 -0
  192. package/dist/utils/passwordstore/index.d.ts +8 -0
  193. package/dist/utils/passwordstore/index.js +378 -0
  194. package/dist/utils/passwordstore/index.js.map +1 -0
  195. package/dist/utils/portForward.d.ts +4 -0
  196. package/dist/utils/portForward.js +116 -0
  197. package/dist/utils/portForward.js.map +1 -0
  198. package/dist/utils/preferences/index.d.ts +3 -0
  199. package/dist/utils/preferences/index.js +119 -0
  200. package/dist/utils/preferences/index.js.map +1 -0
  201. package/dist/utils/projects/index.d.ts +8 -0
  202. package/dist/utils/projects/index.js +154 -0
  203. package/dist/utils/projects/index.js.map +1 -0
  204. package/dist/utils/promise.d.ts +2 -0
  205. package/dist/utils/promise.js +62 -0
  206. package/dist/utils/promise.js.map +1 -0
  207. package/dist/utils/shell.d.ts +1 -0
  208. package/dist/utils/shell.js +81 -0
  209. package/dist/utils/shell.js.map +1 -0
  210. package/package.json +16 -21
  211. package/src/apps/catenv/catenv.ts +48 -27
  212. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  213. package/src/apps/{shell → cli}/commands/general/index.ts +2 -40
  214. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  215. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  216. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  217. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  218. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  219. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
  220. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
  221. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +26 -21
  222. package/src/apps/cli/commands/project/commandConfigSecrets.ts +205 -0
  223. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
  224. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
  225. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  226. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  227. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  228. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  229. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  230. package/src/apps/cli/commands/project/commandInitGitlab.ts +248 -0
  231. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
  232. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  233. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  234. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  235. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  236. package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
  237. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  238. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
  239. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  240. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  241. package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
  242. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  243. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  244. package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
  245. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
  246. package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
  247. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  248. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  249. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +55 -0
  250. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  251. package/src/apps/cli/commands/shared/index.ts +36 -0
  252. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
  253. package/src/apps/cli/config/writeConfig.ts +71 -0
  254. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  255. package/src/apps/cli/verify/index.ts +30 -0
  256. package/src/apps/cli/verify/migration/fromv2.ts +262 -0
  257. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  258. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  259. package/src/catenv.ts +4 -0
  260. package/src/cli.ts +9 -0
  261. package/src/config/constants.ts +0 -1
  262. package/src/config/getProjectConfig.ts +136 -0
  263. package/src/k8sApi/index.ts +5 -1
  264. package/src/types/types.ts +0 -2
  265. package/src/utils/cluster.ts +8 -15
  266. package/src/utils/editAsFile.ts +31 -0
  267. package/src/utils/files.ts +6 -2
  268. package/src/utils/gitlab.ts +133 -34
  269. package/src/utils/passwordstore/index.ts +19 -21
  270. package/src/utils/preferences/index.ts +6 -3
  271. package/src/utils/projects/index.ts +15 -136
  272. package/tsconfig.json +3 -7
  273. package/bin/catenv.sh +0 -1
  274. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  275. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  276. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  277. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  278. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  279. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  280. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  281. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  282. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  283. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  284. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  285. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  286. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  287. package/src/apps/shell/commands/shared/index.ts +0 -31
  288. package/src/config/clusters.ts +0 -45
  289. package/src/index.ts +0 -17
  290. package/src/types/git-repo-name.d.ts +0 -1
  291. package/src/types/yawn-yaml.d.ts +0 -1
  292. package/src/utils/dashboardToken.ts +0 -20
@@ -2,8 +2,6 @@ import memoizee from "memoizee";
2
2
  import Vorpal from "vorpal";
3
3
  import k8sApi from "../../../../k8sApi";
4
4
  import {
5
- connectToCluster,
6
- getAllClusterNames,
7
5
  getCurrentConnectedClusterName,
8
6
  getCurrentContext,
9
7
  } from "../../../../utils/cluster";
@@ -15,10 +13,7 @@ import {
15
13
  } from "../../../../utils/portForward";
16
14
  import { getShell } from "../../../../utils/shell";
17
15
  import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
18
- import {
19
- openGoogleCloudKubernetesDashboard,
20
- openGoogleCloudLogs,
21
- } from "../shared";
16
+ import { openGoogleCloudLogs } from "../shared";
22
17
  import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
23
18
  import portForward from "./portForward";
24
19
 
@@ -34,14 +29,7 @@ export const getAllNamespacesNames = async () => {
34
29
  const namespaces = await getAllNamespaces();
35
30
  return namespaces.map((n) => n.metadata.name);
36
31
  };
37
- export default (vorpal: Vorpal) => {
38
- vorpal
39
- .command("connect-cluster <clustername>")
40
- .autocomplete(getAllClusterNames())
41
- .action(async function ({ clustername }) {
42
- this.log(`connecting to ${clustername}`);
43
- await connectToCluster(clustername);
44
- });
32
+ export default async (vorpal: Vorpal) => {
45
33
  vorpal.command("current-context").action(async function () {
46
34
  this.log(await getCurrentContext());
47
35
  });
@@ -82,32 +70,6 @@ export default (vorpal: Vorpal) => {
82
70
  stopPortForward(name.trim());
83
71
  });
84
72
 
85
- vorpal
86
- .command("open-dashboard <namespace>", "open kubernetes dashboard")
87
- .autocomplete(namespaceAutoCompletion)
88
- .action(async function ({ namespace }) {
89
- const clustername = await getCurrentConnectedClusterName();
90
- const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
91
-
92
- await openGoogleCloudKubernetesDashboard(
93
- authGoogleNumber,
94
- clustername,
95
- namespace
96
- );
97
- });
98
- vorpal
99
- .command(
100
- "open-logs <namespace>",
101
- "open google cloud logs (stackdriver stuff)"
102
- )
103
- .autocomplete(namespaceAutoCompletion)
104
- .action(async function ({ namespace }) {
105
- const clustername = await getCurrentConnectedClusterName();
106
- const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
107
-
108
- await openGoogleCloudLogs(authGoogleNumber, clustername, namespace);
109
- });
110
-
111
73
  vorpal
112
74
  .command("get-shell <namespace>", "get a shell to a pod in the environment")
113
75
  .autocomplete(namespaceAutoCompletion)
@@ -6,7 +6,7 @@ import { startPortForward } from "../../../../utils/portForward";
6
6
  import k8sApi from "../../../../k8sApi";
7
7
  import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
8
8
 
9
- export default (vorpal: Vorpal) =>
9
+ export default async (vorpal: Vorpal) =>
10
10
  vorpal
11
11
  .command("port-forward <namespace>", "start port-forwarding")
12
12
  .autocomplete(namespaceAutoCompletion)
@@ -3,7 +3,7 @@ import projectMongoDestroyMember from "./projectMongoDestroyMember";
3
3
  import projectMongoGetShell from "./projectMongoGetShell";
4
4
  import projectMongoPortForward from "./projectMongoPortForward";
5
5
 
6
- export default (vorpal: Vorpal) => {
6
+ export default async (vorpal: Vorpal) => {
7
7
  projectMongoGetShell(vorpal);
8
8
  projectMongoPortForward(vorpal);
9
9
  projectMongoDestroyMember(vorpal);
@@ -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
  }
@@ -2,18 +2,23 @@ import Vorpal from "vorpal";
2
2
  import { logError } from "../../../../utils/log";
3
3
  import { startPortForward } from "../../../../utils/portForward";
4
4
  import { getProjectNamespace } from "../../../../utils/projects";
5
- import { envAutocompletion } from "../project/utils/autocompletions";
5
+ import { envAndComponents } from "../project/utils/autocompletions";
6
6
  import ensureCluster from "../project/utils/ensureCluster";
7
7
  import { getProjectMongodbAllPodsSortedWithLabel } from "./utils";
8
8
 
9
- export default (vorpal: Vorpal) =>
9
+ export default async (vorpal: Vorpal) =>
10
10
  vorpal
11
- .command("project-mongo-port-forward <env>", "port foward to a mongodb")
12
- .autocomplete(envAutocompletion)
13
- .action(async function ({ env }) {
14
- await ensureCluster.call(this);
15
- const namespace = await getProjectNamespace(env);
16
- const podNames = await getProjectMongodbAllPodsSortedWithLabel(env);
11
+ .command(
12
+ "project-mongo-port-forward <envComponent>",
13
+ "port foward to a mongodb"
14
+ )
15
+ .autocomplete(await envAndComponents())
16
+ .action(async function ({ envComponent }) {
17
+ await ensureCluster.call(this, envComponent);
18
+ const namespace = await getProjectNamespace(envComponent);
19
+ const podNames = await getProjectMongodbAllPodsSortedWithLabel(
20
+ envComponent
21
+ );
17
22
  if (podNames.length === 0) {
18
23
  logError(this, "sorry, no pods found");
19
24
  return;
@@ -1,5 +1,4 @@
1
1
  import { exec, spawn } from "child-process-promise";
2
- import { Env } from "../../../../../types/types";
3
2
  import {
4
3
  getProjectNamespace,
5
4
  getProjectPodNames,
@@ -8,8 +7,8 @@ import {
8
7
  const filterMongoDbs = (podNames: string[]) =>
9
8
  podNames.filter((name) => name.includes("mongodb-replicaset"));
10
9
 
11
- export const getProjectMongodbAllPods = async (env: Env) =>
12
- filterMongoDbs(await getProjectPodNames(env));
10
+ export const getProjectMongodbAllPods = async (envComponent: string) =>
11
+ filterMongoDbs(await getProjectPodNames(envComponent));
13
12
 
14
13
  export const getMongodbShell = async (namespace: string, podName: string) => {
15
14
  const command = `kubectl exec -it ${podName} --namespace ${namespace} mongo`;
@@ -55,12 +54,12 @@ export const podIsMaster = async (namespace: string, podName: string) => {
55
54
 
56
55
  const spaces = (n: number) => " ".repeat(n);
57
56
 
58
- export const getMongoDbPodsWithReplInfo = async (env: Env) => {
59
- const namespace = await getProjectNamespace(env);
57
+ export const getMongoDbPodsWithReplInfo = async (envComponent: string) => {
58
+ const namespace = await getProjectNamespace(envComponent);
60
59
  return (
61
60
  await Promise.all(
62
61
  (
63
- await getProjectMongodbAllPods(env)
62
+ await getProjectMongodbAllPods(envComponent)
64
63
  ).map(async (podName) => ({
65
64
  podName,
66
65
  componentName: podName.replace(/-mongodb-replicaset-[0-9]+/, ""),
@@ -70,8 +69,10 @@ export const getMongoDbPodsWithReplInfo = async (env: Env) => {
70
69
  ).sort((podA, podB) => (podA.isMaster ? (podB.isMaster ? 0 : -1) : 1));
71
70
  };
72
71
 
73
- export const getProjectMongodbAllPodsSortedWithLabel = async (env: Env) => {
74
- const pods = await getMongoDbPodsWithReplInfo(env);
72
+ export const getProjectMongodbAllPodsSortedWithLabel = async (
73
+ envComponent: string
74
+ ) => {
75
+ const pods = await getMongoDbPodsWithReplInfo(envComponent);
75
76
  const maxComponentNameLength = Math.max(
76
77
  ...pods.map((c) => c.componentName.length)
77
78
  );
@@ -1,26 +1,26 @@
1
+ import { isOfDeployType } from "@catladder/pipeline";
1
2
  import { spawn } from "child-process-promise";
2
3
  import { writeFile } from "fs-extra";
3
4
  import { withFile } from "tmp-promise";
4
5
  import Vorpal from "vorpal";
6
+ import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
5
7
  import {
6
- GOOGLE_CLOUD_SQL_PASS_PATH,
7
- GOOGLE_PROJECT,
8
- } from "../../../../config/constants";
8
+ getEnvVars,
9
+ getPipelineContextByChoice,
10
+ getProjectConfig,
11
+ parseChoice,
12
+ } from "../../../../config/getProjectConfig";
9
13
  import { readPass } from "../../../../utils/passwordstore";
10
- import {
11
- getAllEnvVars,
12
- getLocalProjectVariables,
13
- getProjectValues,
14
- } from "../../../../utils/projects";
15
- import { envAutocompletion } from "./utils/autocompletions";
16
- import { promptForSubAppIfAny } from "./utils/monorepo";
14
+ import { envAndComponents } from "./utils/autocompletions";
17
15
 
18
- export default (vorpal: Vorpal) =>
16
+ export default async (vorpal: Vorpal) =>
19
17
  vorpal
20
- .command("project-cloud-sql-proxy <env>", "proxy to cloud sql db")
21
- .autocomplete(envAutocompletion)
22
- .action(async function ({ env }) {
23
- const { CUSTOMER_NAME, APP_NAME } = await getLocalProjectVariables();
18
+ .command("project-cloud-sql-proxy <envComponent>", "proxy to cloud sql db")
19
+ .autocomplete(await envAndComponents())
20
+ .action(async function ({ envComponent }) {
21
+ const { env, componentName } = parseChoice(envComponent);
22
+
23
+ const config = await getProjectConfig();
24
24
  // skynet-164509:europe-west6:pvl-cyclomania-review=tcp:5432
25
25
 
26
26
  const { localPort } = await this.prompt({
@@ -30,18 +30,23 @@ export default (vorpal: Vorpal) =>
30
30
  message: "Local port: ",
31
31
  });
32
32
 
33
- const subapp = await promptForSubAppIfAny(this);
34
- const POSTGRESQL_PASSWORD = (await getAllEnvVars(env, subapp))
33
+ const POSTGRESQL_PASSWORD = (await getEnvVars(this, env, componentName))
35
34
  ?.POSTGRESQL_PASSWORD;
36
35
 
37
- const values = await getProjectValues(env, subapp);
38
- this.log("");
36
+ const context = await getPipelineContextByChoice(env, componentName);
37
+ if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
38
+ throw new Error("currently only supported for kubernetes deployment");
39
+ }
39
40
  this.log(`postgres-PW: ${POSTGRESQL_PASSWORD}`);
40
41
  this.log("");
41
42
 
42
- const projectId = values?.cloudsql?.projectId || GOOGLE_PROJECT;
43
+ const values = context.componentConfig.deploy.values;
44
+
45
+ const projectId =
46
+ values?.cloudsql?.projectId ||
47
+ context.componentConfig.deploy.cluster?.projectId;
43
48
 
44
- const defaultInstanceId = `${CUSTOMER_NAME}-${APP_NAME}-${env}`;
49
+ const defaultInstanceId = `${config.customerName}-${config.appName}-${env}`;
45
50
  const instanceId = values?.cloudsql?.instanceId || defaultInstanceId;
46
51
 
47
52
  const defaultRegion = "europe-west6"; // currently hardcoded
@@ -0,0 +1,205 @@
1
+ /* eslint-disable no-constant-condition */
2
+ import { stripIndents } from "common-tags";
3
+ import { difference } from "lodash";
4
+ import Vorpal, { CommandInstance } from "vorpal";
5
+ import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
6
+ import {
7
+ getAllComponentsWithAllEnvsHierarchical,
8
+ getEnvironment,
9
+ getEnvVars,
10
+ getPipelineContextByChoice,
11
+ getProjectComponents,
12
+ parseChoice,
13
+ } from "../../../../config/getProjectConfig";
14
+ import { editAsFile } from "../../../../utils/editAsFile";
15
+ import { upsertAllVariables } from "../../../../utils/gitlab";
16
+ import { hasBitwarden, readPass } from "../../../../utils/passwordstore";
17
+ import { delay } from "../../../../utils/promise";
18
+ import { allEnvsAndAllComponents } from "./utils/autocompletions";
19
+
20
+ type Vars = {
21
+ [env: string]: {
22
+ [componentName: string]: Record<string, string>;
23
+ };
24
+ };
25
+ /* for convenience, parse json objects. that makes it easier to edit secrets that are object */
26
+ const resolveJson = (v: Vars) =>
27
+ Object.fromEntries(
28
+ Object.entries(v).map(([componentName, envs]) => {
29
+ return [
30
+ componentName,
31
+ Object.fromEntries(
32
+ Object.entries(envs).map(([env, secrets]) => [
33
+ env,
34
+ Object.fromEntries(
35
+ Object.entries(secrets).map(([key, value]) => {
36
+ try {
37
+ return [key, JSON.parse(value)];
38
+ } catch (e) {
39
+ return [key, value];
40
+ }
41
+ })
42
+ ),
43
+ ])
44
+ ),
45
+ ];
46
+ })
47
+ );
48
+ const getEnvVarsToEdit = async (
49
+ instance: CommandInstance,
50
+ env: string,
51
+ componentName: string
52
+ ) => {
53
+ const { secretEnvVarKeys } = await getEnvironment(env, componentName);
54
+
55
+ const allEnvVars = await getEnvVars(instance, env, componentName);
56
+ return Object.fromEntries(
57
+ secretEnvVarKeys.map((key) => [key, allEnvVars[key]])
58
+ );
59
+ };
60
+ const doItFor = async (
61
+ instance: CommandInstance,
62
+ envAndComponents: {
63
+ [componentName: string]: string[];
64
+ }
65
+ ) => {
66
+ let valuesToEdit: Vars = Object.fromEntries(
67
+ await Promise.all(
68
+ Object.entries(envAndComponents).map(async ([componentName, envs]) => [
69
+ componentName,
70
+ Object.fromEntries(
71
+ await Promise.all(
72
+ envs.map(async (env) => [
73
+ env,
74
+ await getEnvVarsToEdit(instance, env, componentName),
75
+ ])
76
+ )
77
+ ),
78
+ ])
79
+ )
80
+ );
81
+ let hasErrors = true;
82
+ while (hasErrors) {
83
+ valuesToEdit = await editAsFile(
84
+ resolveJson(valuesToEdit),
85
+ stripIndents`
86
+ Please fill in all secrets for:
87
+
88
+ ${Object.entries(envAndComponents)
89
+ .map(
90
+ ([componentName, envs]) => `- ${componentName}: ${envs.join(", ")}`
91
+ )
92
+ .join("\n")}
93
+
94
+ `
95
+ );
96
+ // check for errors
97
+ hasErrors = false;
98
+ for (const [componentName, envs] of Object.entries(envAndComponents)) {
99
+ for (const env of envs) {
100
+ const usedKeys = valuesToEdit[componentName][env]
101
+ ? Object.keys(valuesToEdit[componentName][env])
102
+ : [];
103
+ // check whether newValues have the exact number of keys
104
+ const { secretEnvVarKeys } = await getEnvironment(env, componentName);
105
+ const extranous = difference(usedKeys, secretEnvVarKeys);
106
+ const missing = difference(secretEnvVarKeys, usedKeys);
107
+
108
+ if (extranous.length > 0 || missing.length > 0) {
109
+ instance.log("");
110
+ instance.log(
111
+ `😿 Oh no! There is something wrong with "${componentName}"`
112
+ );
113
+ instance.log("");
114
+ if (extranous.length > 0) {
115
+ instance.log("these secrets are not declared in the config");
116
+ extranous.forEach((key) => instance.log(key));
117
+ instance.log("");
118
+ }
119
+ if (missing.length > 0) {
120
+ instance.log("these secrets have not been provided:");
121
+ missing.forEach((key) => instance.log(key));
122
+ instance.log("");
123
+ }
124
+
125
+ await delay(1000);
126
+ const { shouldContinue } = await instance.prompt({
127
+ default: true,
128
+ message: "Try again? 🤔",
129
+ name: "shouldContinue",
130
+ type: "confirm",
131
+ });
132
+
133
+ if (!shouldContinue) {
134
+ throw new Error("abort");
135
+ }
136
+ hasErrors = true;
137
+ }
138
+ }
139
+ }
140
+ }
141
+ for (const [componentName, envs] of Object.entries(envAndComponents)) {
142
+ for (const env of envs) {
143
+ await upsertAllVariables(
144
+ instance,
145
+ valuesToEdit[componentName][env],
146
+ env,
147
+ componentName
148
+ );
149
+
150
+ if (hasBitwarden()) {
151
+ // add cloud sql secret if needed.
152
+ // TODO: this is legacy, in the future we want to have one service account per app
153
+
154
+ const context = await getPipelineContextByChoice(env, componentName);
155
+ if (
156
+ context.componentConfig.deploy &&
157
+ context.componentConfig.deploy.values?.cloudsql?.enabled
158
+ ) {
159
+ await upsertAllVariables(
160
+ instance,
161
+ {
162
+ cloudsqlProxyCredentials: await readPass(
163
+ GOOGLE_CLOUD_SQL_PASS_PATH
164
+ ),
165
+ },
166
+ env,
167
+ componentName
168
+ );
169
+ }
170
+ }
171
+ }
172
+ }
173
+ };
174
+
175
+ export default async (vorpal: Vorpal) => {
176
+ vorpal
177
+ .command(
178
+ "project-config-secrets [envComponent]",
179
+ "setup/update secrets stored in pass"
180
+ )
181
+ .autocomplete(await allEnvsAndAllComponents())
182
+ .action(async function ({ envComponent }) {
183
+ if (!envComponent) {
184
+ const allEnvAndcomponents =
185
+ await getAllComponentsWithAllEnvsHierarchical();
186
+ await doItFor(this, allEnvAndcomponents);
187
+ } else {
188
+ const { env, componentName } = parseChoice(envComponent);
189
+
190
+ // componentName can be null. in this case, iterate over all components
191
+ if (!componentName) {
192
+ const components = await getProjectComponents();
193
+ await doItFor(
194
+ this,
195
+ Object.fromEntries(components.map((c) => [c, [env]]))
196
+ );
197
+ }
198
+ if (componentName) {
199
+ await doItFor(this, {
200
+ [componentName]: [env],
201
+ });
202
+ }
203
+ }
204
+ });
205
+ };
@@ -1,27 +1,24 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import Vorpal from "vorpal";
3
+ import { GOOGLE_CLOUD_SQL_PASS_PATH } from "../../../../config/constants";
3
4
  import {
4
- GOOGLE_CLOUD_SQL_PASS_PATH,
5
- GOOGLE_PROJECT,
6
- } from "../../../../config/constants";
5
+ getEnvVars,
6
+ getProjectConfig,
7
+ parseChoice,
8
+ } from "../../../../config/getProjectConfig";
7
9
  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";
10
+ import { envAndComponents } from "./utils/autocompletions";
14
11
 
15
- export default (vorpal: Vorpal) =>
12
+ export default async (vorpal: Vorpal) =>
16
13
  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();
14
+ .command(
15
+ "copy-db <envComponent>",
16
+ "replace local db with the one from an env"
17
+ )
18
+ .autocomplete(await envAndComponents())
19
+ .action(async function copyDB({ envComponent }) {
20
+ const { env, componentName } = parseChoice(envComponent);
21
+ const { customerName, appName } = await getProjectConfig();
25
22
 
26
23
  const { shouldContinue } = await this.prompt({
27
24
  type: "confirm",
@@ -34,15 +31,18 @@ export default (vorpal: Vorpal) =>
34
31
  return;
35
32
  }
36
33
 
37
- const subapp = await promptForSubAppIfAny(this);
38
-
34
+ // TODO: reimpleent with new config
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..."