@opencrvs/toolkit 2.1.0-rc.69ab488 → 2.1.0-rc.6bae709
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.
- package/README.md +1 -0
- package/create-countryconfig/index.js +114 -66
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +230 -197
- package/dist/cli.js +174 -106
- package/dist/commons/api/router.d.ts +3608 -3367
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionConfig.d.ts +112 -105
- package/dist/commons/events/ActionDocument.d.ts +117 -123
- package/dist/commons/events/ActionInput.d.ts +0 -6
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +519 -507
- package/dist/commons/events/AuditLog.d.ts +189 -42
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -37
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -5
- package/dist/commons/events/EventDocument.d.ts +48 -48
- package/dist/commons/events/EventIndex.d.ts +49 -72
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +406 -389
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +192 -12
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +40 -43
- package/dist/commons/events/utils.d.ts +122 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +303 -55
- package/dist/environment/derived-variables.d.ts +119 -131
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +0 -14
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +3 -3
- package/dist/environment/manage-users.js +17 -7
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +10 -29
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +34 -12
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +28 -20
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +17 -7
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3914 -3562
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/notification/index.js +1937 -1112
- package/dist/scopes/index.d.ts +394 -169
- package/dist/scopes/index.js +304 -55
- package/dist/templates/charts-values/dependencies/values.yaml +0 -3
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.6bae709.tgz +0 -0
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.69ab488.tgz +0 -0
|
@@ -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:
|
|
5
|
+
type: 'text';
|
|
5
6
|
message: string;
|
|
6
|
-
valueType:
|
|
7
|
+
valueType: 'SECRET';
|
|
7
8
|
valueLabel: string;
|
|
8
|
-
validate:
|
|
9
|
+
validate: typeof notEmpty;
|
|
9
10
|
initial: string | undefined;
|
|
10
|
-
scope:
|
|
11
|
+
scope: 'REPOSITORY';
|
|
11
12
|
}[];
|
|
12
13
|
export declare const githubQuestions: {
|
|
13
14
|
name: string;
|
|
14
|
-
type:
|
|
15
|
+
type: 'text';
|
|
15
16
|
message: string;
|
|
16
|
-
validate:
|
|
17
|
+
validate: typeof notEmpty;
|
|
17
18
|
initial: string;
|
|
18
|
-
scope:
|
|
19
|
+
scope: 'REPOSITORY';
|
|
19
20
|
}[];
|
|
20
21
|
export declare const githubOtherQuestions: ({
|
|
21
22
|
name: string;
|
|
22
|
-
type:
|
|
23
|
+
type: 'text';
|
|
23
24
|
message: string;
|
|
24
25
|
initial: string | undefined;
|
|
25
|
-
valueType:
|
|
26
|
+
valueType: 'VARIABLE';
|
|
26
27
|
valueLabel: string;
|
|
27
|
-
scope:
|
|
28
|
+
scope: 'REPOSITORY';
|
|
28
29
|
choices?: undefined;
|
|
29
30
|
validate?: undefined;
|
|
30
31
|
} | {
|
|
31
32
|
name: string;
|
|
32
|
-
type:
|
|
33
|
+
type: 'select';
|
|
33
34
|
message: string;
|
|
34
35
|
choices: {
|
|
35
36
|
title: string;
|
|
36
37
|
value: string;
|
|
37
38
|
}[];
|
|
38
|
-
valueType:
|
|
39
|
-
validate:
|
|
39
|
+
valueType: 'VARIABLE';
|
|
40
|
+
validate: typeof notEmpty;
|
|
40
41
|
valueLabel: string;
|
|
41
42
|
initial: string | undefined;
|
|
42
|
-
scope:
|
|
43
|
+
scope: 'ENVIRONMENT';
|
|
43
44
|
})[];
|
|
44
45
|
export declare const githubTokenQuestion: {
|
|
45
46
|
name: string;
|
|
46
|
-
type:
|
|
47
|
+
type: 'text';
|
|
47
48
|
message: string;
|
|
48
|
-
validate:
|
|
49
|
+
validate: typeof notEmpty;
|
|
49
50
|
initial: string | undefined;
|
|
50
|
-
valueType:
|
|
51
|
-
scope:
|
|
51
|
+
valueType: 'SECRET';
|
|
52
|
+
scope: 'REPOSITORY';
|
|
52
53
|
valueLabel: string;
|
|
53
54
|
}[];
|
|
54
55
|
export declare const countryQuestions: {
|
|
55
56
|
name: string;
|
|
56
|
-
type:
|
|
57
|
+
type: 'text';
|
|
57
58
|
message: string;
|
|
58
|
-
valueType:
|
|
59
|
+
valueType: 'VARIABLE';
|
|
59
60
|
valueLabel: string;
|
|
60
61
|
initial: string | undefined;
|
|
61
|
-
scope:
|
|
62
|
+
scope: 'REPOSITORY';
|
|
62
63
|
}[];
|
|
63
64
|
export declare const infrastructureQuestions: ({
|
|
64
65
|
name: string;
|
|
65
|
-
type:
|
|
66
|
+
type: 'text';
|
|
66
67
|
message: string;
|
|
67
|
-
valueType:
|
|
68
|
-
validate:
|
|
68
|
+
valueType: 'VARIABLE';
|
|
69
|
+
validate: typeof notEmpty;
|
|
69
70
|
valueLabel: string;
|
|
70
71
|
initial: string | undefined;
|
|
71
|
-
scope:
|
|
72
|
+
scope: 'ENVIRONMENT';
|
|
72
73
|
} | {
|
|
74
|
+
validate?: undefined;
|
|
73
75
|
name: string;
|
|
74
|
-
type:
|
|
76
|
+
type: 'text';
|
|
75
77
|
message: string;
|
|
76
|
-
valueType:
|
|
78
|
+
valueType: 'VARIABLE';
|
|
77
79
|
valueLabel: string;
|
|
78
80
|
initial: string | undefined;
|
|
79
|
-
scope:
|
|
80
|
-
validate?: undefined;
|
|
81
|
+
scope: 'ENVIRONMENT';
|
|
81
82
|
} | {
|
|
82
83
|
name: string;
|
|
83
|
-
type:
|
|
84
|
+
type: 'text';
|
|
84
85
|
message: string;
|
|
85
|
-
valueType:
|
|
86
|
+
valueType: 'VARIABLE';
|
|
86
87
|
validate: typeof validateCIDRs;
|
|
87
88
|
valueLabel: string;
|
|
88
89
|
initial: string;
|
|
89
|
-
scope:
|
|
90
|
+
scope: 'ENVIRONMENT';
|
|
90
91
|
})[];
|
|
91
92
|
export declare const staticSSLCertQuestions: {
|
|
92
93
|
name: string;
|
|
93
|
-
type:
|
|
94
|
+
type: 'text';
|
|
94
95
|
message: string;
|
|
95
|
-
valueType:
|
|
96
|
-
validate:
|
|
96
|
+
valueType: 'SECRET';
|
|
97
|
+
validate: typeof notEmpty;
|
|
97
98
|
valueLabel: string;
|
|
98
99
|
initial: string | undefined;
|
|
99
|
-
scope:
|
|
100
|
+
scope: 'ENVIRONMENT';
|
|
100
101
|
}[];
|
|
101
102
|
export declare const backupQuestions: ({
|
|
103
|
+
choices?: undefined;
|
|
104
|
+
validate?: undefined;
|
|
102
105
|
name: string;
|
|
103
|
-
type:
|
|
106
|
+
type: 'text';
|
|
104
107
|
message: string;
|
|
105
|
-
valueType:
|
|
108
|
+
valueType: 'VARIABLE';
|
|
106
109
|
valueLabel: string;
|
|
107
110
|
initial: string;
|
|
108
|
-
scope:
|
|
109
|
-
validate?: undefined;
|
|
110
|
-
choices?: undefined;
|
|
111
|
+
scope: 'ENVIRONMENT';
|
|
111
112
|
} | {
|
|
113
|
+
choices?: undefined;
|
|
112
114
|
name: string;
|
|
113
|
-
type:
|
|
115
|
+
type: 'text';
|
|
114
116
|
message: string;
|
|
115
|
-
valueType:
|
|
116
|
-
validate:
|
|
117
|
+
valueType: 'SECRET';
|
|
118
|
+
validate: typeof notEmpty;
|
|
117
119
|
valueLabel: string;
|
|
118
120
|
initial: string;
|
|
119
|
-
scope:
|
|
120
|
-
choices?: undefined;
|
|
121
|
+
scope: 'ENVIRONMENT';
|
|
121
122
|
} | {
|
|
122
123
|
name: string;
|
|
123
|
-
type:
|
|
124
|
+
type: 'select';
|
|
124
125
|
message: string;
|
|
125
126
|
choices: {
|
|
126
127
|
title: string;
|
|
127
128
|
value: string;
|
|
128
129
|
}[];
|
|
129
|
-
valueType:
|
|
130
|
-
validate:
|
|
130
|
+
valueType: 'VARIABLE';
|
|
131
|
+
validate: typeof notEmpty;
|
|
131
132
|
valueLabel: string;
|
|
132
133
|
initial: string | undefined;
|
|
133
|
-
scope:
|
|
134
|
+
scope: 'ENVIRONMENT';
|
|
134
135
|
})[];
|
|
135
136
|
export declare const diskQuestions: {
|
|
136
137
|
name: string;
|
|
137
|
-
type:
|
|
138
|
+
type: 'text';
|
|
138
139
|
message: string;
|
|
139
|
-
valueType:
|
|
140
|
-
validate:
|
|
140
|
+
valueType: 'VARIABLE';
|
|
141
|
+
validate: typeof notEmpty;
|
|
141
142
|
valueLabel: string;
|
|
142
143
|
initial: string;
|
|
143
|
-
scope:
|
|
144
|
+
scope: 'ENVIRONMENT';
|
|
144
145
|
}[];
|
|
145
146
|
export declare const databaseAndMonitoringQuestions: {
|
|
146
147
|
name: string;
|
|
147
|
-
type:
|
|
148
|
+
type: 'text';
|
|
148
149
|
message: string;
|
|
149
|
-
valueType:
|
|
150
|
-
validate:
|
|
150
|
+
valueType: 'SECRET';
|
|
151
|
+
validate: typeof notEmpty;
|
|
151
152
|
valueLabel: string;
|
|
152
153
|
initial: string;
|
|
153
|
-
scope:
|
|
154
|
+
scope: 'ENVIRONMENT';
|
|
154
155
|
}[];
|
|
155
156
|
export declare const emailQuestions: ({
|
|
157
|
+
choices?: undefined;
|
|
156
158
|
name: string;
|
|
157
|
-
type:
|
|
159
|
+
type: 'text';
|
|
158
160
|
message: string;
|
|
159
|
-
valueType:
|
|
160
|
-
validate:
|
|
161
|
+
valueType: 'SECRET';
|
|
162
|
+
validate: typeof notEmpty;
|
|
161
163
|
valueLabel: string;
|
|
162
164
|
initial: string | undefined;
|
|
163
|
-
scope:
|
|
164
|
-
choices?: undefined;
|
|
165
|
+
scope: 'ENVIRONMENT';
|
|
165
166
|
} | {
|
|
166
167
|
name: string;
|
|
167
|
-
type:
|
|
168
|
+
type: 'select';
|
|
168
169
|
message: string;
|
|
169
170
|
choices: {
|
|
170
171
|
title: string;
|
|
171
172
|
value: string;
|
|
172
173
|
}[];
|
|
173
|
-
valueType:
|
|
174
|
-
validate:
|
|
174
|
+
valueType: 'SECRET';
|
|
175
|
+
validate: typeof notEmpty;
|
|
175
176
|
valueLabel: string;
|
|
176
177
|
initial: string | undefined;
|
|
177
|
-
scope:
|
|
178
|
+
scope: 'ENVIRONMENT';
|
|
178
179
|
})[];
|
|
179
180
|
export declare const sentryQuestions: {
|
|
180
181
|
name: string;
|
|
181
|
-
type:
|
|
182
|
+
type: 'text';
|
|
182
183
|
message: string;
|
|
183
|
-
valueType:
|
|
184
|
-
validate:
|
|
184
|
+
valueType: 'SECRET';
|
|
185
|
+
validate: typeof notEmpty;
|
|
185
186
|
valueLabel: string;
|
|
186
187
|
initial: string | undefined;
|
|
187
|
-
scope:
|
|
188
|
+
scope: 'ENVIRONMENT';
|
|
188
189
|
}[];
|
|
189
190
|
export declare const metabaseAdminQuestions: {
|
|
190
|
-
valueType:
|
|
191
|
+
valueType: 'SECRET';
|
|
191
192
|
name: string;
|
|
192
|
-
type:
|
|
193
|
+
type: 'text';
|
|
193
194
|
message: string;
|
|
194
195
|
valueLabel: string;
|
|
195
|
-
scope:
|
|
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":"
|
|
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;;;WAId,aAAa;;;UAId,MAAM;;eAED,UAAU;;;;WAId,aAAa;IAYvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;UAGzB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,eAAe;;;;UAGlB,MAAM;;eAED,UAAU;;;WAId,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"}
|
|
@@ -59,6 +59,7 @@ const questions_1 = require("./questions");
|
|
|
59
59
|
const editor_questions_1 = require("./editor-questions");
|
|
60
60
|
const questions_helper_1 = require("./questions-helper");
|
|
61
61
|
const manage_users_1 = require("./manage-users");
|
|
62
|
+
const paths_1 = require("./paths");
|
|
62
63
|
function questionToPrompt(_a) {
|
|
63
64
|
var { valueType, valueLabel, scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
|
|
64
65
|
return promptOptions;
|
|
@@ -161,13 +162,10 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
161
162
|
const existingValuesForQuestions = questions
|
|
162
163
|
// Only variables can have previous values we can use
|
|
163
164
|
.filter((question) => question.valueType === 'VARIABLE')
|
|
164
|
-
.map((question) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
(_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
|
|
169
|
-
];
|
|
170
|
-
});
|
|
165
|
+
.map((question) => { var _a; return [
|
|
166
|
+
question.name,
|
|
167
|
+
(_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
|
|
168
|
+
]; });
|
|
171
169
|
return Object.assign(Object.assign({}, Object.fromEntries(existingValuesForQuestions)), result);
|
|
172
170
|
});
|
|
173
171
|
}
|
|
@@ -274,7 +272,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
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)(
|
|
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 = [];
|
|
@@ -490,20 +488,6 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
490
488
|
value: findExistingOrDefine('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
491
489
|
scope: 'ENVIRONMENT'
|
|
492
490
|
},
|
|
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
491
|
{
|
|
508
492
|
name: 'POSTGRES_USER',
|
|
509
493
|
type: 'SECRET',
|
|
@@ -603,13 +587,10 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
603
587
|
derivedUpdates.push(...applicationServerUpdates);
|
|
604
588
|
const updates = getAnswers(existingValues)
|
|
605
589
|
.concat(...derivedUpdates.filter((update) => update.value !== null))
|
|
606
|
-
.filter((variable) => {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
(variable.type !== 'VARIABLE' ||
|
|
611
|
-
variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value));
|
|
612
|
-
});
|
|
590
|
+
.filter((variable) => { var _a; return Boolean(variable.value) &&
|
|
591
|
+
// Only update values that changed
|
|
592
|
+
(variable.type !== 'VARIABLE' ||
|
|
593
|
+
variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value)); });
|
|
613
594
|
(0, utils_1.storeSecrets)(environment, updates);
|
|
614
595
|
/*
|
|
615
596
|
* List out all updates to the variables and confirm with the user
|
|
@@ -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 (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAKvC;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAYpD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAWpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CASnD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,CAStD;AAGD;;;;GAIG;AACH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QA0CzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAsBzE"}
|
|
@@ -34,6 +34,7 @@ exports.generateInventory = generateInventory;
|
|
|
34
34
|
const fs_1 = __importDefault(require("fs"));
|
|
35
35
|
const path_1 = __importDefault(require("path"));
|
|
36
36
|
const logger_1 = require("./logger");
|
|
37
|
+
const paths_1 = require("./paths");
|
|
37
38
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
38
39
|
// Register a helper to increment numbers
|
|
39
40
|
handlebars_1.default.registerHelper('data_label_idx', function (value) {
|
|
@@ -149,7 +150,7 @@ function copyChartsValues(env, values) {
|
|
|
149
150
|
function generateInventory(env, values) {
|
|
150
151
|
// Template and output paths
|
|
151
152
|
const templatePath = path_1.default.join(__dirname, 'templates', 'inventory', 'inventory.template.yml');
|
|
152
|
-
const outputPath = path_1.default.
|
|
153
|
+
const outputPath = path_1.default.resolve(process.cwd(), (0, paths_1.getEnvironmentInventoryPath)(env));
|
|
153
154
|
const templateFile = fs_1.default.readFileSync(templatePath, 'utf-8');
|
|
154
155
|
const template = handlebars_1.default.compile(templateFile);
|
|
155
156
|
values['single_node'] =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"AA+HA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
|
|
@@ -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 (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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) {
|
|
@@ -50,12 +60,21 @@ const path_1 = require("path");
|
|
|
50
60
|
const glob = __importStar(require("glob"));
|
|
51
61
|
const yaml = __importStar(require("js-yaml"));
|
|
52
62
|
const logger_1 = require("./logger");
|
|
63
|
+
const paths_1 = require("./paths");
|
|
64
|
+
function isDirectory(path) {
|
|
65
|
+
try {
|
|
66
|
+
return (0, fs_1.statSync)(path).isDirectory();
|
|
67
|
+
}
|
|
68
|
+
catch (_a) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
53
72
|
function extractInfrastructureNames() {
|
|
54
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const files = glob.sync('
|
|
56
|
-
const infraEnvironments = files.map((file) => (0, path_1.basename)(
|
|
74
|
+
const files = glob.sync((0, path_1.join)('environments', '*', paths_1.INVENTORY_FILE_NAME));
|
|
75
|
+
const infraEnvironments = files.map((file) => (0, path_1.basename)((0, path_1.dirname)(file)));
|
|
57
76
|
if (infraEnvironments.length === 0) {
|
|
58
|
-
console.log(
|
|
77
|
+
console.log(`⚠️ Warning: No environment inventory files found at environments/*/${paths_1.INVENTORY_FILE_NAME}`);
|
|
59
78
|
return [];
|
|
60
79
|
}
|
|
61
80
|
(0, logger_1.log)('🔍 Found infrastructure configurations:', infraEnvironments.join(', '));
|
|
@@ -67,8 +86,11 @@ function extractEnvironmentNames() {
|
|
|
67
86
|
const entries = yield (0, promises_1.readdir)('environments');
|
|
68
87
|
// Filter only directories
|
|
69
88
|
const environments = entries.filter((entry) => {
|
|
70
|
-
const
|
|
71
|
-
|
|
89
|
+
const environmentPath = (0, path_1.join)('environments', entry);
|
|
90
|
+
const opencrvsServicesPath = (0, path_1.join)(environmentPath, 'opencrvs-services');
|
|
91
|
+
return (isDirectory(environmentPath) &&
|
|
92
|
+
(0, fs_1.existsSync)(opencrvsServicesPath) &&
|
|
93
|
+
isDirectory(opencrvsServicesPath));
|
|
72
94
|
});
|
|
73
95
|
if (environments.length === 0) {
|
|
74
96
|
console.log('⚠️ Warning: No environment directories found in environments/');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/environment/upgrade.ts"],"names":[],"mappings":"AAkFA,wBAAsB,wBAAwB,kBAY7C"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.upgradeEnvironmentLayout = upgradeEnvironmentLayout;
|
|
26
|
+
const fs_1 = require("fs");
|
|
27
|
+
const path_1 = require("path");
|
|
28
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
29
|
+
const logger_1 = require("./logger");
|
|
30
|
+
const paths_1 = require("./paths");
|
|
31
|
+
const update_workflows_1 = require("./update-workflows");
|
|
32
|
+
function moveFileIfDestinationMissing(sourcePath, destinationPath) {
|
|
33
|
+
if (!(0, fs_1.existsSync)(sourcePath)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if ((0, fs_1.existsSync)(destinationPath)) {
|
|
37
|
+
(0, logger_1.warn)(`⚠️ Skipped ${sourcePath}; destination already exists at ${destinationPath}`);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(destinationPath), { recursive: true });
|
|
41
|
+
(0, fs_1.renameSync)(sourcePath, destinationPath);
|
|
42
|
+
(0, logger_1.log)(` ✓ Moved ${sourcePath} -> ${destinationPath}`);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
function migrateInventoryFiles() {
|
|
46
|
+
const oldInventoryFiles = (0, paths_1.findOldInventoryFiles)();
|
|
47
|
+
if (oldInventoryFiles.length === 0) {
|
|
48
|
+
(0, logger_1.log)(`ℹ️ No old inventory files found at ${paths_1.OLD_INVENTORY_DIR}`);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
(0, logger_1.log)(kleur_1.default.bold('\nMigrating Ansible inventory files'));
|
|
52
|
+
let didMoveInventory = false;
|
|
53
|
+
for (const oldInventoryFile of oldInventoryFiles) {
|
|
54
|
+
const environment = (0, paths_1.getEnvironmentNameFromOldInventoryPath)(oldInventoryFile);
|
|
55
|
+
didMoveInventory =
|
|
56
|
+
moveFileIfDestinationMissing(oldInventoryFile, (0, paths_1.getEnvironmentInventoryPath)(environment)) || didMoveInventory;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
if ((0, fs_1.existsSync)(paths_1.OLD_INVENTORY_DIR) &&
|
|
60
|
+
(0, fs_1.readdirSync)(paths_1.OLD_INVENTORY_DIR).length === 0) {
|
|
61
|
+
(0, fs_1.rmdirSync)(paths_1.OLD_INVENTORY_DIR);
|
|
62
|
+
(0, logger_1.log)(` ✓ Removed empty ${paths_1.OLD_INVENTORY_DIR}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (_a) {
|
|
66
|
+
(0, logger_1.warn)(`⚠️ Could not remove ${paths_1.OLD_INVENTORY_DIR}; please review it manually`);
|
|
67
|
+
}
|
|
68
|
+
return didMoveInventory;
|
|
69
|
+
}
|
|
70
|
+
function upgradeEnvironmentLayout() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const didMoveInventory = migrateInventoryFiles();
|
|
73
|
+
yield (0, update_workflows_1.updateWorkflowEnvironments)();
|
|
74
|
+
if (didMoveInventory) {
|
|
75
|
+
(0, logger_1.success)('\n✅ Environment layout upgrade completed successfully.');
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
(0, logger_1.success)('\n✅ Environment layout already uses the current structure.');
|
|
79
|
+
}
|
|
80
|
+
(0, logger_1.log)('\nCommit changes into git after upgrade');
|
|
81
|
+
});
|
|
82
|
+
}
|