@opencrvs/toolkit 2.1.0-rc.a74bce1 → 2.1.0-rc.aae3e77

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 (134) hide show
  1. package/README.md +3 -12
  2. package/build.sh +9 -1
  3. package/create-countryconfig/index.js +412 -59
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +342 -276
  7. package/dist/authentication/index.d.ts +67 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +750 -0
  10. package/dist/cli.js +1894 -300
  11. package/dist/commons/api/router.d.ts +3977 -3419
  12. package/dist/commons/application-config/index.d.ts +6 -6
  13. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  14. package/dist/commons/conditionals/validate.d.ts +16 -5
  15. package/dist/commons/events/ActionConfig.d.ts +112 -105
  16. package/dist/commons/events/ActionDocument.d.ts +121 -127
  17. package/dist/commons/events/ActionInput.d.ts +4 -10
  18. package/dist/commons/events/ActionStatus.d.ts +14 -0
  19. package/dist/commons/events/ActionType.d.ts +62 -62
  20. package/dist/commons/events/AdvancedSearchConfig.d.ts +531 -507
  21. package/dist/commons/events/AuditLog.d.ts +189 -42
  22. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  23. package/dist/commons/events/Conditional.d.ts +3 -3
  24. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  25. package/dist/commons/events/Draft.d.ts +37 -37
  26. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  27. package/dist/commons/events/EventConfig.d.ts +8 -5
  28. package/dist/commons/events/EventDocument.d.ts +518 -50
  29. package/dist/commons/events/EventIndex.d.ts +49 -72
  30. package/dist/commons/events/EventMetadata.d.ts +39 -49
  31. package/dist/commons/events/EventStatus.d.ts +19 -0
  32. package/dist/commons/events/FieldConfig.d.ts +425 -389
  33. package/dist/commons/events/FieldType.d.ts +51 -51
  34. package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
  35. package/dist/commons/events/FieldValue.d.ts +14 -14
  36. package/dist/commons/events/Flag.d.ts +57 -15
  37. package/dist/commons/events/PlainDate.d.ts +8 -0
  38. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  39. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  40. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  41. package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
  42. package/dist/commons/events/deduplication.d.ts +1 -1
  43. package/dist/commons/events/event.d.ts +14 -2
  44. package/dist/commons/events/field.d.ts +69 -198
  45. package/dist/commons/events/index.d.ts +1 -0
  46. package/dist/commons/events/locationPayloads.d.ts +95 -0
  47. package/dist/commons/events/locations.d.ts +247 -14
  48. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  49. package/dist/commons/events/scopes.d.ts +4 -4
  50. package/dist/commons/events/state/index.d.ts +17 -17
  51. package/dist/commons/events/state/utils.d.ts +7 -7
  52. package/dist/commons/events/test.utils.d.ts +64 -46
  53. package/dist/commons/events/utils.d.ts +133 -114
  54. package/dist/commons/notification/UserNotifications.d.ts +38 -23
  55. package/dist/commons/notification/dispatch.d.ts +10 -0
  56. package/dist/commons/notification/index.d.ts +1 -0
  57. package/dist/conditionals/index.js +328 -58
  58. package/dist/csv.d.ts +25 -0
  59. package/dist/csv.d.ts.map +1 -0
  60. package/dist/csv.js +120 -0
  61. package/dist/environment/derived-variables.d.ts +119 -131
  62. package/dist/environment/derived-variables.d.ts.map +1 -1
  63. package/dist/environment/derived-variables.js +0 -14
  64. package/dist/environment/index.d.ts +1 -0
  65. package/dist/environment/index.d.ts.map +1 -1
  66. package/dist/environment/index.js +10 -0
  67. package/dist/environment/logger.d.ts +6 -3
  68. package/dist/environment/logger.d.ts.map +1 -1
  69. package/dist/environment/manage-users.js +18 -8
  70. package/dist/environment/paths.d.ts +7 -0
  71. package/dist/environment/paths.d.ts.map +1 -0
  72. package/dist/environment/paths.js +72 -0
  73. package/dist/environment/questions.d.ts +75 -74
  74. package/dist/environment/questions.d.ts.map +1 -1
  75. package/dist/environment/questions.js +20 -14
  76. package/dist/environment/setup-environment.js +55 -56
  77. package/dist/environment/swarm-to-k8s.js +17 -7
  78. package/dist/environment/templates.d.ts +0 -1
  79. package/dist/environment/templates.d.ts.map +1 -1
  80. package/dist/environment/templates.js +5 -9
  81. package/dist/environment/update-workflows.d.ts.map +1 -1
  82. package/dist/environment/update-workflows.js +38 -12
  83. package/dist/environment/upgrade.d.ts +2 -0
  84. package/dist/environment/upgrade.d.ts.map +1 -0
  85. package/dist/environment/upgrade.js +82 -0
  86. package/dist/environment/users.js +28 -20
  87. package/dist/environment/utils.d.ts +1 -13
  88. package/dist/environment/utils.d.ts.map +1 -1
  89. package/dist/environment/utils.js +18 -35
  90. package/dist/events/deduplication.d.ts +1 -1
  91. package/dist/events/index.js +7616 -7113
  92. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  93. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  94. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  95. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  96. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  97. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  98. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  99. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  100. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  101. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  102. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  103. package/dist/migrations/v2.1/add-translations.js +213 -0
  104. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  105. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  106. package/dist/migrations/v2.1/enable-telemetry.js +438 -0
  107. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  108. package/dist/migrations/v2.1/index.js +1058 -0
  109. package/dist/notification/index.js +1866 -1466
  110. package/dist/scopes/index.d.ts +464 -169
  111. package/dist/scopes/index.js +329 -58
  112. package/dist/telemetry/index.d.ts +45 -0
  113. package/dist/telemetry/index.d.ts.map +1 -0
  114. package/dist/telemetry/index.js +39 -0
  115. package/dist/templates/charts-values/dependencies/values.yaml +2 -3
  116. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
  117. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  118. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  119. package/dist/templates/inventory/inventory.template.yml +1 -3
  120. package/dist/translations/check.d.ts +21 -0
  121. package/dist/translations/check.d.ts.map +1 -0
  122. package/dist/translations/check.js +132 -0
  123. package/dist/verify/endpoints.d.ts +2 -0
  124. package/dist/verify/endpoints.d.ts.map +1 -0
  125. package/dist/verify/endpoints.js +345 -0
  126. package/opencrvs-toolkit-2.1.0-rc.aae3e77.tgz +0 -0
  127. package/package.json +12 -7
  128. package/tsconfig.build.json +11 -0
  129. package/tsconfig.build.tsbuildinfo +1 -0
  130. package/tsconfig.json +3 -0
  131. package/dist/templates/inventory/production.example.yml +0 -77
  132. package/dist/templates/inventory/qa.example.yml +0 -48
  133. package/opencrvs-toolkit-2.1.0-rc.a74bce1.tgz +0 -0
  134. package/tsconfig.tsbuildinfo +0 -1
@@ -1,198 +1,199 @@
1
+ declare const notEmpty: (value: string | number) => "Please enter a value" | true;
1
2
  declare function validateCIDRs(input: string): true | string;
2
3
  export declare const dockerhubQuestions: {
3
4
  name: string;
4
- type: "text";
5
+ type: 'text';
5
6
  message: string;
6
- valueType: "SECRET";
7
+ valueType: 'SECRET';
7
8
  valueLabel: string;
8
- validate: (value: string | number) => true | "Please enter a value";
9
+ validate: typeof notEmpty;
9
10
  initial: string | undefined;
10
- scope: "REPOSITORY";
11
+ scope: 'REPOSITORY';
11
12
  }[];
12
13
  export declare const githubQuestions: {
13
14
  name: string;
14
- type: "text";
15
+ type: 'text';
15
16
  message: string;
16
- validate: (value: string | number) => true | "Please enter a value";
17
+ validate: typeof notEmpty;
17
18
  initial: string;
18
- scope: "REPOSITORY";
19
+ scope: 'REPOSITORY';
19
20
  }[];
20
21
  export declare const githubOtherQuestions: ({
21
22
  name: string;
22
- type: "text";
23
+ type: 'text';
23
24
  message: string;
24
25
  initial: string | undefined;
25
- valueType: "VARIABLE";
26
+ valueType: 'VARIABLE';
26
27
  valueLabel: string;
27
- scope: "REPOSITORY";
28
+ scope: 'REPOSITORY';
28
29
  choices?: undefined;
29
30
  validate?: undefined;
30
31
  } | {
31
32
  name: string;
32
- type: "select";
33
+ type: 'select';
33
34
  message: string;
34
35
  choices: {
35
36
  title: string;
36
37
  value: string;
37
38
  }[];
38
- valueType: "VARIABLE";
39
- validate: (value: string | number) => true | "Please enter a value";
39
+ valueType: 'VARIABLE';
40
+ validate: typeof notEmpty;
40
41
  valueLabel: string;
41
42
  initial: string | undefined;
42
- scope: "ENVIRONMENT";
43
+ scope: 'ENVIRONMENT';
43
44
  })[];
44
45
  export declare const githubTokenQuestion: {
45
46
  name: string;
46
- type: "text";
47
+ type: 'text';
47
48
  message: string;
48
- validate: (value: string | number) => true | "Please enter a value";
49
+ validate: typeof notEmpty;
49
50
  initial: string | undefined;
50
- valueType: "SECRET";
51
- scope: "REPOSITORY";
51
+ valueType: 'SECRET';
52
+ scope: 'REPOSITORY';
52
53
  valueLabel: string;
53
54
  }[];
54
55
  export declare const countryQuestions: {
55
56
  name: string;
56
- type: "text";
57
+ type: 'text';
57
58
  message: string;
58
- valueType: "VARIABLE";
59
+ valueType: 'VARIABLE';
59
60
  valueLabel: string;
60
61
  initial: string | undefined;
61
- scope: "REPOSITORY";
62
+ scope: 'REPOSITORY';
62
63
  }[];
63
64
  export declare const infrastructureQuestions: ({
64
65
  name: string;
65
- type: "text";
66
+ type: 'text';
66
67
  message: string;
67
- valueType: "VARIABLE";
68
- validate: (value: string | number) => true | "Please enter a value";
68
+ valueType: 'VARIABLE';
69
+ validate: typeof notEmpty;
69
70
  valueLabel: string;
70
71
  initial: string | undefined;
71
- scope: "ENVIRONMENT";
72
+ scope: 'ENVIRONMENT';
72
73
  } | {
74
+ validate?: undefined;
73
75
  name: string;
74
- type: "text";
76
+ type: 'text';
75
77
  message: string;
76
- valueType: "VARIABLE";
78
+ valueType: 'VARIABLE';
77
79
  valueLabel: string;
78
80
  initial: string | undefined;
79
- scope: "ENVIRONMENT";
80
- validate?: undefined;
81
+ scope: 'ENVIRONMENT';
81
82
  } | {
82
83
  name: string;
83
- type: "text";
84
+ type: 'text';
84
85
  message: string;
85
- valueType: "VARIABLE";
86
+ valueType: 'VARIABLE';
86
87
  validate: typeof validateCIDRs;
87
88
  valueLabel: string;
88
89
  initial: string;
89
- scope: "ENVIRONMENT";
90
+ scope: 'ENVIRONMENT';
90
91
  })[];
91
92
  export declare const staticSSLCertQuestions: {
92
93
  name: string;
93
- type: "text";
94
+ type: 'text';
94
95
  message: string;
95
- valueType: "SECRET";
96
- validate: (value: string | number) => true | "Please enter a value";
96
+ valueType: 'SECRET';
97
+ validate: typeof notEmpty;
97
98
  valueLabel: string;
98
99
  initial: string | undefined;
99
- scope: "ENVIRONMENT";
100
+ scope: 'ENVIRONMENT';
100
101
  }[];
101
102
  export declare const backupQuestions: ({
103
+ choices?: undefined;
104
+ validate?: undefined;
102
105
  name: string;
103
- type: "text";
106
+ type: 'text';
104
107
  message: string;
105
- valueType: "VARIABLE";
108
+ valueType: 'VARIABLE';
106
109
  valueLabel: string;
107
110
  initial: string;
108
- scope: "ENVIRONMENT";
109
- validate?: undefined;
110
- choices?: undefined;
111
+ scope: 'ENVIRONMENT';
111
112
  } | {
113
+ choices?: undefined;
112
114
  name: string;
113
- type: "text";
115
+ type: 'text';
114
116
  message: string;
115
- valueType: "SECRET";
116
- validate: (value: string | number) => true | "Please enter a value";
117
+ valueType: 'SECRET';
118
+ validate: typeof notEmpty;
117
119
  valueLabel: string;
118
120
  initial: string;
119
- scope: "ENVIRONMENT";
120
- choices?: undefined;
121
+ scope: 'ENVIRONMENT';
121
122
  } | {
122
123
  name: string;
123
- type: "select";
124
+ type: 'select';
124
125
  message: string;
125
126
  choices: {
126
127
  title: string;
127
128
  value: string;
128
129
  }[];
129
- valueType: "VARIABLE";
130
- validate: (value: string | number) => true | "Please enter a value";
130
+ valueType: 'VARIABLE';
131
+ validate: typeof notEmpty;
131
132
  valueLabel: string;
132
133
  initial: string | undefined;
133
- scope: "ENVIRONMENT";
134
+ scope: 'ENVIRONMENT';
134
135
  })[];
135
136
  export declare const diskQuestions: {
136
137
  name: string;
137
- type: "text";
138
+ type: 'text';
138
139
  message: string;
139
- valueType: "VARIABLE";
140
- validate: (value: string | number) => true | "Please enter a value";
140
+ valueType: 'VARIABLE';
141
+ validate: typeof notEmpty;
141
142
  valueLabel: string;
142
143
  initial: string;
143
- scope: "ENVIRONMENT";
144
+ scope: 'ENVIRONMENT';
144
145
  }[];
145
146
  export declare const databaseAndMonitoringQuestions: {
146
147
  name: string;
147
- type: "text";
148
+ type: 'text';
148
149
  message: string;
149
- valueType: "SECRET";
150
- validate: (value: string | number) => true | "Please enter a value";
150
+ valueType: 'SECRET';
151
+ validate: typeof notEmpty;
151
152
  valueLabel: string;
152
153
  initial: string;
153
- scope: "ENVIRONMENT";
154
+ scope: 'ENVIRONMENT';
154
155
  }[];
155
156
  export declare const emailQuestions: ({
157
+ choices?: undefined;
156
158
  name: string;
157
- type: "text";
159
+ type: 'text';
158
160
  message: string;
159
- valueType: "SECRET";
160
- validate: (value: string | number) => true | "Please enter a value";
161
+ valueType: 'SECRET';
162
+ validate: typeof notEmpty;
161
163
  valueLabel: string;
162
164
  initial: string | undefined;
163
- scope: "ENVIRONMENT";
164
- choices?: undefined;
165
+ scope: 'ENVIRONMENT';
165
166
  } | {
166
167
  name: string;
167
- type: "select";
168
+ type: 'select';
168
169
  message: string;
169
170
  choices: {
170
171
  title: string;
171
172
  value: string;
172
173
  }[];
173
- valueType: "SECRET";
174
- validate: (value: string | number) => true | "Please enter a value";
174
+ valueType: 'SECRET';
175
+ validate: typeof notEmpty;
175
176
  valueLabel: string;
176
177
  initial: string | undefined;
177
- scope: "ENVIRONMENT";
178
+ scope: 'ENVIRONMENT';
178
179
  })[];
179
180
  export declare const sentryQuestions: {
180
181
  name: string;
181
- type: "text";
182
+ type: 'text';
182
183
  message: string;
183
- valueType: "SECRET";
184
- validate: (value: string | number) => true | "Please enter a value";
184
+ valueType: 'SECRET';
185
+ validate: typeof notEmpty;
185
186
  valueLabel: string;
186
187
  initial: string | undefined;
187
- scope: "ENVIRONMENT";
188
+ scope: 'ENVIRONMENT';
188
189
  }[];
189
190
  export declare const metabaseAdminQuestions: {
190
- valueType: "SECRET";
191
+ valueType: 'SECRET';
191
192
  name: string;
192
- type: "text";
193
+ type: 'text';
193
194
  message: string;
194
195
  valueLabel: string;
195
- scope: "ENVIRONMENT";
196
+ scope: 'ENVIRONMENT';
196
197
  initial: string;
197
198
  }[];
198
199
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/environment/questions.ts"],"names":[],"mappings":"AA+BA,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBnD;AAED,eAAO,MAAM,kBAAkB;;;;;;sBAlCN,MAAM,GAAG,MAAM;;;GA4EvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;sBA9EH,MAAM,GAAG,MAAM;;;GA+FvC,CAAA;AACD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;sBAhGR,MAAM,GAAG,MAAM;;;;IA+HvC,CAAA;AACD,eAAO,MAAM,mBAAmB;;;;sBAhIP,MAAM,GAAG,MAAM;;;;;GA2IvC,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;GAW5B,CAAA;AAED,eAAO,MAAM,uBAAuB;;;;;sBA1JX,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;IAmMvC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;sBArMV,MAAM,GAAG,MAAM;;;;GA0NvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;sBA5NH,MAAM,GAAG,MAAM;;;;;;;;;;;;;;sBAAf,MAAM,GAAG,MAAM;;;;IAqQvC,CAAA;AAED,eAAO,MAAM,aAAa;;;;;sBAvQD,MAAM,GAAG,MAAM;;;;GAoRvC,CAAA;AAED,eAAO,MAAM,8BAA8B;;;;;sBAtRlB,MAAM,GAAG,MAAM;;;;GA2SvC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;sBA7SF,MAAM,GAAG,MAAM;;;;;;;;;;;;;;sBAAf,MAAM,GAAG,MAAM;;;;IA+XvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;;sBAjYH,MAAM,GAAG,MAAM;;;;GA4YvC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;GAoBlC,CAAA"}
1
+ {"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/environment/questions.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,QAAQ,UAAW,MAAM,GAAG,MAAM,kCAC4B,CAAA;AAepE,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBnD;AAED,eAAO,MAAM,kBAAkB;;UAGrB,MAAM;;eAED,QAAQ;;;;WAIZ,YAAY;GAiCtB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;;;WAIL,YAAY;GAUtB,CAAA;AACD,eAAO,MAAM,oBAAoB;;UAGvB,MAAM;;;eAGD,UAAU;;WAEd,YAAY;;;;;UAIb,QAAQ;;;;;;eAaH,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AACD,eAAO,MAAM,mBAAmB;;UAGtB,MAAM;;;;eAID,QAAQ;WACZ,YAAY;;GAGtB,CAAA;AAED,eAAO,MAAM,gBAAgB;;UAGnB,MAAM;;eAGD,UAAU;;;WAGd,YAAY;GAEtB,CAAA;AAED,eAAO,MAAM,uBAAuB;;UAG1B,MAAM;;eAED,UAAU;;;;WAId,aAAa;;;;UAId,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;UAsBd,MAAM;;eAED,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;UAGzB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,eAAe;;;;UAGlB,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;;UAId,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;UAId,QAAQ;;;;;;eAYH,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,aAAa;;UAGhB,MAAM;;eAID,UAAU;;;;WAId,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,8BAA8B;;UAGjC,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,cAAc;;;UAGjB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;UAkCd,QAAQ;;;;;;eAYH,QAAQ;;;;WAIZ,aAAa;IAuBvB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;eAEpB,QAAQ;;UAEb,MAAM;;;WAIL,aAAa;;GAYvB,CAAA"}
@@ -166,11 +166,28 @@ exports.infrastructureQuestions = [
166
166
  scope: 'ENVIRONMENT'
167
167
  },
168
168
  {
169
- name: 'kubeAPIHost',
169
+ name: 'kubeMasterNode',
170
170
  type: 'text',
171
- message: `Kubernetes API endpoint (default: auto-detect)`,
171
+ message: `Kubernetes master node hostnames or IP (default: auto-detect)`,
172
+ valueType: 'VARIABLE',
173
+ valueLabel: 'KUBE_MASTER_NODE',
174
+ initial: process.env.KUBE_MASTER_NODE,
175
+ scope: 'ENVIRONMENT'
176
+ },
177
+ {
178
+ name: 'kubeWorkerNodes',
179
+ type: 'text',
180
+ message: `Kubernetes worker node hostnames or IPs (comma-separated, default: no worker nodes)`,
181
+ valueType: 'VARIABLE',
182
+ valueLabel: 'KUBE_WORKER_NODES',
183
+ initial: process.env.KUBE_WORKER_NODES || '',
184
+ scope: 'ENVIRONMENT'
185
+ },
186
+ {
187
+ name: 'kubeApiHost',
188
+ type: 'text',
189
+ message: `Kubernetes API endpoint IP (default: KUBE_MASTER_NODE)`,
172
190
  valueType: 'VARIABLE',
173
- // validate: notEmpty,
174
191
  valueLabel: 'KUBE_API_HOST',
175
192
  initial: process.env.KUBE_API_HOST,
176
193
  scope: 'ENVIRONMENT'
@@ -185,16 +202,6 @@ exports.infrastructureQuestions = [
185
202
  initial: process.env.KUBE_API_ALLOWED_CIDRS || '',
186
203
  scope: 'ENVIRONMENT'
187
204
  },
188
- {
189
- name: 'kubeWorkerNodes',
190
- type: 'text',
191
- message: `Kubernetes worker node hostnames or IPs (comma-separated, default: no worker nodes)`,
192
- valueType: 'VARIABLE',
193
- // validate: notEmpty,
194
- valueLabel: 'KUBE_WORKER_NODES',
195
- initial: process.env.KUBE_WORKER_NODES || '',
196
- scope: 'ENVIRONMENT'
197
- }
198
205
  ];
199
206
  exports.staticSSLCertQuestions = [
200
207
  {
@@ -224,7 +231,6 @@ exports.backupQuestions = [
224
231
  type: 'text',
225
232
  message: `Please enter backup server host/IP address, (default: no backup):`,
226
233
  valueType: 'VARIABLE',
227
- // validate: notEmpty,
228
234
  valueLabel: 'BACKUP_HOST',
229
235
  initial: process.env.BACKUP_HOST || '',
230
236
  scope: 'ENVIRONMENT'
@@ -34,7 +34,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34
34
  };
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const core_1 = require("@octokit/core");
37
- const dotenv_1 = __importDefault(require("dotenv"));
38
37
  const kleur_1 = __importDefault(require("kleur"));
39
38
  const prompts_1 = __importDefault(require("prompts"));
40
39
  function confirm(options) {
@@ -49,6 +48,12 @@ function select(options) {
49
48
  return inquirer.select(options);
50
49
  });
51
50
  }
51
+ function input(options) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const inquirer = yield import('@inquirer/prompts');
54
+ return inquirer.input(options);
55
+ });
56
+ }
52
57
  const github_1 = require("./github");
53
58
  const derived_variables_1 = require("./derived-variables");
54
59
  const utils_1 = require("./utils");
@@ -59,6 +64,7 @@ const questions_1 = require("./questions");
59
64
  const editor_questions_1 = require("./editor-questions");
60
65
  const questions_helper_1 = require("./questions-helper");
61
66
  const manage_users_1 = require("./manage-users");
67
+ const paths_1 = require("./paths");
62
68
  function questionToPrompt(_a) {
63
69
  var { valueType, valueLabel, scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
64
70
  return promptOptions;
@@ -104,7 +110,7 @@ function getAnswers(existingValues) {
104
110
  });
105
111
  });
106
112
  }
107
- function promptAndStoreAnswer(environment, questions, existingValues) {
113
+ function promptAndStoreAnswer(questions, existingValues) {
108
114
  return __awaiter(this, void 0, void 0, function* () {
109
115
  (0, logger_1.log)('');
110
116
  const processedQuestions = questions.flatMap((question) => {
@@ -157,30 +163,26 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
157
163
  }
158
164
  });
159
165
  ALL_ANSWERS.push(result);
160
- (0, utils_1.storeSecrets)(environment, getAnswers(existingValues));
161
166
  const existingValuesForQuestions = questions
162
167
  // Only variables can have previous values we can use
163
168
  .filter((question) => question.valueType === 'VARIABLE')
164
- .map((question) => {
165
- var _a;
166
- return [
167
- question.name,
168
- (_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
169
- ];
170
- });
169
+ .map((question) => { var _a; return [
170
+ question.name,
171
+ (_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
172
+ ]; });
171
173
  return Object.assign(Object.assign({}, Object.fromEntries(existingValuesForQuestions)), result);
172
174
  });
173
175
  }
174
176
  ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOtherQuestions, ...questions_1.dockerhubQuestions, ...questions_1.diskQuestions, ...questions_1.infrastructureQuestions, ...questions_1.backupQuestions, ...questions_1.countryQuestions, ...questions_1.databaseAndMonitoringQuestions, ...questions_1.emailQuestions, ...questions_1.sentryQuestions, ...derived_variables_1.derivedVariables, ...questions_1.metabaseAdminQuestions);
175
177
  (() => __awaiter(void 0, void 0, void 0, function* () {
176
- var _a, _b, _c;
178
+ var _a, _b, _c, _d;
177
179
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Github'), '\n');
178
180
  const { githubOrganisation, githubRepository } = yield (0, prompts_1.default)(questions_1.githubQuestions.map(questionToPrompt), {
179
181
  onCancel: () => {
180
182
  process.exit(1);
181
183
  }
182
184
  });
183
- const { githubToken } = yield promptAndStoreAnswer('', questions_1.githubTokenQuestion, []);
185
+ const { githubToken } = yield promptAndStoreAnswer(questions_1.githubTokenQuestion, []);
184
186
  const octokit = new core_1.Octokit({
185
187
  auth: githubToken
186
188
  });
@@ -240,10 +242,6 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
240
242
  if (!environment) {
241
243
  process.exit(1);
242
244
  }
243
- // Read users .env file based on the environment name they gave above, e.g. .env.production
244
- dotenv_1.default.config({
245
- path: `${process.cwd()}/.env.${environment}`
246
- });
247
245
  yield (0, github_1.createEnvironment)(octokit, environment, githubOrganisation, githubRepository);
248
246
  const repositoryId = yield (0, github_1.getRepositoryId)(octokit, githubOrganisation, githubRepository);
249
247
  const existingRepositorySecrets = yield (0, github_1.listRepositorySecrets)(octokit, githubOrganisation, githubRepository);
@@ -264,17 +262,17 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
264
262
  (0, logger_1.log)('\n', kleur_1.default
265
263
  .yellow()
266
264
  .bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
267
- yield promptAndStoreAnswer(environment, questions_1.githubOtherQuestions, existingValues);
265
+ yield promptAndStoreAnswer(questions_1.githubOtherQuestions, existingValues);
268
266
  }
269
267
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
270
- yield promptAndStoreAnswer(environment, questions_1.dockerhubQuestions, existingValues);
268
+ yield promptAndStoreAnswer(questions_1.dockerhubQuestions, existingValues);
271
269
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
272
- const infrastructure = yield promptAndStoreAnswer(environment, questions_1.infrastructureQuestions, existingValues);
270
+ const infrastructure = yield promptAndStoreAnswer(questions_1.infrastructureQuestions, existingValues);
273
271
  const kubeWorkerNodes = infrastructure.kubeWorkerNodes
274
272
  ? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
275
273
  : [];
276
274
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
277
- const users = yield (0, manage_users_1.manageUsers)(`infrastructure/server-setup/inventory/${environment}.yml`);
275
+ const users = yield (0, manage_users_1.manageUsers)((0, paths_1.getEnvironmentInventoryPath)(environment));
278
276
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
279
277
  const sslCertExists = (0, utils_1.findExistingValue)('SSL_CRT', 'SECRET', 'ENVIRONMENT', existingValues);
280
278
  let ssl_answers = [];
@@ -311,7 +309,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
311
309
  }
312
310
  if (enableEncryption && !encryption_key_defined && !environment_exists) {
313
311
  (0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow(' Disk encryption is enabled'));
314
- yield promptAndStoreAnswer(environment, questions_1.diskQuestions, existingValues);
312
+ yield promptAndStoreAnswer(questions_1.diskQuestions, existingValues);
315
313
  }
316
314
  else {
317
315
  if (!enableEncryption && !encryption_key_defined && environment_exists) {
@@ -333,7 +331,8 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
333
331
  let backupHost = ((_a = (0, utils_1.findExistingValue)('BACKUP_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _a === void 0 ? void 0 : _a.value) || '';
334
332
  let backupType = '';
335
333
  let restoreEnvironmentName = (_b = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _b === void 0 ? void 0 : _b.value;
336
- let restoreType = ((_c = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _c === void 0 ? void 0 : _c.value) ||
334
+ let restoreHost = ((_c = (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _c === void 0 ? void 0 : _c.value) || '';
335
+ let restoreType = ((_d = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _d === void 0 ? void 0 : _d.value) ||
337
336
  process.env.RESTORE_ENVIRONMENT_MODE ||
338
337
  'dump';
339
338
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Backup'));
@@ -348,7 +347,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
348
347
  let backupHostPrivateKey = '';
349
348
  let backupHostPublicKey = '';
350
349
  if (configureBackup) {
351
- const backupAnswers = yield promptAndStoreAnswer(environment, questions_1.backupQuestions, existingValues);
350
+ const backupAnswers = yield promptAndStoreAnswer(questions_1.backupQuestions, existingValues);
352
351
  const backupHostPrivateKeyExists = (0, utils_1.findExistingValue)('BACKUP_HOST_PRIVATE_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
353
352
  backupType = backupAnswers.backupType;
354
353
  backupHost = backupAnswers.backupHost || backupHost;
@@ -395,16 +394,20 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
395
394
  }
396
395
  ]
397
396
  });
397
+ restoreHost = yield input({
398
+ message: 'What is the host/IP address of the restore backup server?',
399
+ default: restoreHost
400
+ });
398
401
  }
399
402
  else {
400
403
  (0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Restore is disabled'));
401
404
  }
402
405
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Monitoring'));
403
- yield promptAndStoreAnswer(environment, questions_1.databaseAndMonitoringQuestions, existingValues);
406
+ yield promptAndStoreAnswer(questions_1.databaseAndMonitoringQuestions, existingValues);
404
407
  const sentryDSNExists = (0, utils_1.findExistingValue)('SENTRY_DSN', 'SECRET', 'ENVIRONMENT', existingValues);
405
408
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Sentry'));
406
409
  if (sentryDSNExists) {
407
- yield promptAndStoreAnswer(environment, questions_1.sentryQuestions, existingValues);
410
+ yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
408
411
  }
409
412
  else {
410
413
  const { useSentry } = yield (0, prompts_1.default)([
@@ -416,13 +419,13 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
416
419
  }
417
420
  ]);
418
421
  if (useSentry) {
419
- yield promptAndStoreAnswer(environment, questions_1.sentryQuestions, existingValues);
422
+ yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
420
423
  }
421
424
  }
422
425
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('METABASE ADMIN'));
423
- yield promptAndStoreAnswer(environment, questions_1.metabaseAdminQuestions, existingValues);
426
+ yield promptAndStoreAnswer(questions_1.metabaseAdminQuestions, existingValues);
424
427
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('SMTP'));
425
- yield promptAndStoreAnswer(environment, questions_1.emailQuestions, existingValues);
428
+ yield promptAndStoreAnswer(questions_1.emailQuestions, existingValues);
426
429
  const allAnswers = ALL_ANSWERS.reduce((acc, answer) => {
427
430
  return Object.assign(Object.assign({}, acc), answer);
428
431
  });
@@ -490,20 +493,6 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
490
493
  value: findExistingOrDefine('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
491
494
  scope: 'ENVIRONMENT'
492
495
  },
493
- {
494
- name: 'MONGODB_ADMIN_USER',
495
- type: 'SECRET',
496
- didExist: (0, utils_1.findExistingValue)('MONGODB_ADMIN_USER', 'SECRET', 'ENVIRONMENT', existingValues),
497
- value: findExistingOrDefine('MONGODB_ADMIN_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
498
- scope: 'ENVIRONMENT'
499
- },
500
- {
501
- name: 'MONGODB_ADMIN_PASSWORD',
502
- type: 'SECRET',
503
- didExist: (0, utils_1.findExistingValue)('MONGODB_ADMIN_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
504
- value: findExistingOrDefine('MONGODB_ADMIN_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
505
- scope: 'ENVIRONMENT'
506
- },
507
496
  {
508
497
  name: 'POSTGRES_USER',
509
498
  type: 'SECRET',
@@ -573,6 +562,13 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
573
562
  value: answerOrExisting(restoreEnvironmentName, (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => val || ''),
574
563
  didExist: (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues),
575
564
  scope: 'ENVIRONMENT'
565
+ },
566
+ {
567
+ type: 'VARIABLE',
568
+ name: 'RESTORE_HOST',
569
+ value: answerOrExisting(restoreHost, (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => val || ''),
570
+ didExist: (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
571
+ scope: 'ENVIRONMENT'
576
572
  }
577
573
  ];
578
574
  if (enableEncryption) {
@@ -603,14 +599,10 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
603
599
  derivedUpdates.push(...applicationServerUpdates);
604
600
  const updates = getAnswers(existingValues)
605
601
  .concat(...derivedUpdates.filter((update) => update.value !== null))
606
- .filter((variable) => {
607
- var _a;
608
- return Boolean(variable.value) &&
609
- // Only update values that changed
610
- (variable.type !== 'VARIABLE' ||
611
- variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value));
612
- });
613
- (0, utils_1.storeSecrets)(environment, updates);
602
+ .filter((variable) => { var _a; return Boolean(variable.value) &&
603
+ // Only update values that changed
604
+ (variable.type !== 'VARIABLE' ||
605
+ variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value)); });
614
606
  /*
615
607
  * List out all updates to the variables and confirm with the user
616
608
  */
@@ -689,6 +681,10 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
689
681
  .concat(updatedVariables).length === 0) {
690
682
  process.exit(0);
691
683
  }
684
+ (0, logger_1.log)(kleur_1.default
685
+ .bold()
686
+ .red("⚠️ COPY THESE NOW INTO A PASSWORD MANAGER — YOU WON'T SEE THEM AGAIN"));
687
+ (0, logger_1.log)('');
692
688
  const saveChanges = yield confirm({
693
689
  message: 'Do you want to continue?',
694
690
  default: true
@@ -736,7 +732,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
736
732
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Running configuration files updates'));
737
733
  (0, templates_1.generateInventory)(environment, {
738
734
  kube_worker_nodes: kubeWorkerNodes,
739
- kube_api_host: infrastructure.kubeAPIHost || '',
735
+ kube_api_host: infrastructure.kubeApiHost || '',
740
736
  backup_host: backupHost || '',
741
737
  users: users
742
738
  });
@@ -747,12 +743,14 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
747
743
  // Hardcode like this blocks us from being generic:
748
744
  // https://github.com/opencrvs/opencrvs-core/issues/11171
749
745
  two_fa_enabled: environment !== 'production' ? false : true,
750
- backup_enabled: configureBackup ? true : false,
746
+ traefik_mode: traefikConfOption,
751
747
  restore_enabled: restoreEnvironmentName ? true : false,
752
748
  restore_environment_name: restoreEnvironmentName || '',
753
749
  restore_type: restoreType,
754
- traefik_mode: traefikConfOption,
755
- backup_type: backupType
750
+ restore_host: restoreHost || '',
751
+ backup_enabled: configureBackup ? true : false,
752
+ backup_type: backupType,
753
+ backup_host: backupHost || ''
756
754
  });
757
755
  let addon_message = kubeWorkerNodes.length > 0 || configureBackup
758
756
  ? '--------------------------------------------------------------------------------------------\n' +
@@ -789,6 +787,7 @@ ${addon_message}
789
787
  ${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
790
788
  ${kleur_1.default.yellow('Please KINDLY read hints above')}
791
789
  `);
792
- (0, logger_1.log)('\nAll variables stored in', kleur_1.default.cyan(`.env.${environment}`));
793
- (0, logger_1.log)(kleur_1.default.bold().yellow('DO NOT COMMIT THIS FILE TO GIT!'));
790
+ (0, logger_1.log)('\nAll secrets and variables were printed above.', kleur_1.default
791
+ .bold()
792
+ .yellow('Store them in a password manager — they are not saved to disk.'));
794
793
  }))();
@@ -25,13 +25,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
35
45
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
46
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
47
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1,4 +1,3 @@
1
- export declare function getUsers(data: any): any;
2
1
  export declare function extractAndModifyUsers(data: any): any;
3
2
  export declare function dockerManagerFirst(data: any): string;
4
3
  export declare function extractBackupNode(data: any): string;