@opencrvs/toolkit 2.0.0-rc.358eace → 2.0.0-rc.3598fb7
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/build.sh +3 -3
- package/dist/application-config/index.js +17 -6
- package/dist/cli.js +328 -226
- package/dist/commons/api/router.d.ts +10 -0
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionConfig.d.ts +7 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventIndex.d.ts +25 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +39 -0
- package/dist/commons/events/locations.d.ts +1 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +9 -0
- package/dist/commons/events/utils.d.ts +8 -0
- package/dist/conditionals/index.js +10 -5
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +1 -1
- package/dist/environment/editor-questions.d.ts.map +1 -1
- package/dist/environment/editor-questions.js +6 -4
- package/dist/environment/git.js +5 -5
- package/dist/environment/github.d.ts.map +1 -1
- package/dist/environment/github.js +15 -12
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +2 -1
- package/dist/environment/manage-users.d.ts.map +1 -1
- package/dist/environment/manage-users.js +11 -8
- package/dist/environment/questions-helper.d.ts.map +1 -1
- package/dist/environment/questions-helper.js +5 -5
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +13 -13
- package/dist/environment/setup-environment.js +75 -54
- package/dist/environment/ssh-keygen.d.ts.map +1 -1
- package/dist/environment/ssh-keygen.js +5 -2
- package/dist/environment/swarm-to-k8s.js +16 -15
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +16 -12
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +6 -5
- package/dist/environment/users.d.ts +1 -1
- package/dist/environment/users.d.ts.map +1 -1
- package/dist/environment/users.js +19 -9
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -1
- package/dist/events/index.js +69 -18
- package/dist/migrations/v2.0/index.js +10 -5
- package/dist/notification/index.js +32 -17
- package/dist/scopes/index.d.ts +89 -1
- package/dist/scopes/index.js +10 -5
- package/dist/{environment/templates → templates}/charts-values/dependencies/values.yaml +7 -6
- package/dist/{environment/templates/charts-values/dependencies → templates/charts-values/opencrvs-services}/values.override.yaml +1 -1
- package/dist/{environment/templates → templates}/charts-values/opencrvs-services/values.yaml +8 -6
- package/dist/{environment/templates → templates}/charts-values/traefik/values.override.yaml +1 -1
- package/dist/{environment/templates → templates}/charts-values/traefik/values.yaml +6 -7
- package/dist/{environment/templates → templates}/inventory/production.example.yml +2 -2
- package/opencrvs-toolkit-2.0.0-rc.3598fb7.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.358eace.tgz +0 -0
- /package/dist/{environment/templates/charts-values/opencrvs-services → templates/charts-values/dependencies}/values.override.yaml +0 -0
- /package/dist/{environment/templates → templates}/inventory/inventory.template.yml +0 -0
- /package/dist/{environment/templates → templates}/inventory/qa.example.yml +0 -0
|
@@ -60,13 +60,7 @@ 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
62
|
function questionToPrompt(_a) {
|
|
63
|
-
var {
|
|
64
|
-
// eslint-disable-next-line no-unused-vars
|
|
65
|
-
valueType,
|
|
66
|
-
// eslint-disable-next-line no-unused-vars
|
|
67
|
-
valueLabel,
|
|
68
|
-
// eslint-disable-next-line no-unused-vars
|
|
69
|
-
scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
|
|
63
|
+
var { valueType, valueLabel, scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
|
|
70
64
|
return promptOptions;
|
|
71
65
|
}
|
|
72
66
|
const ALL_QUESTIONS = [];
|
|
@@ -83,24 +77,29 @@ function getAnswers(existingValues) {
|
|
|
83
77
|
});
|
|
84
78
|
return questionsThatAreSecretsOrVariables.map(([key, value]) => {
|
|
85
79
|
const existingQuestion = ALL_QUESTIONS.find((question) => question.name === key);
|
|
86
|
-
|
|
80
|
+
if (!(existingQuestion === null || existingQuestion === void 0 ? void 0 : existingQuestion.valueLabel) ||
|
|
81
|
+
(existingQuestion.valueType !== 'SECRET' &&
|
|
82
|
+
existingQuestion.valueType !== 'VARIABLE')) {
|
|
83
|
+
throw new Error(`No secret or variable question found for ${key}`);
|
|
84
|
+
}
|
|
85
|
+
const { valueLabel, valueType, scope } = existingQuestion;
|
|
87
86
|
if (valueType === 'SECRET') {
|
|
88
|
-
const existingSecret = (0, utils_1.findExistingValue)(
|
|
87
|
+
const existingSecret = (0, utils_1.findExistingValue)(valueLabel, 'SECRET', scope, existingValues);
|
|
89
88
|
return {
|
|
90
89
|
type: valueType,
|
|
91
|
-
name:
|
|
90
|
+
name: valueLabel,
|
|
92
91
|
value: value.toString(),
|
|
93
92
|
didExist: existingSecret,
|
|
94
|
-
scope
|
|
93
|
+
scope
|
|
95
94
|
};
|
|
96
95
|
}
|
|
97
|
-
const existingVariable = (0, utils_1.findExistingValue)(
|
|
96
|
+
const existingVariable = (0, utils_1.findExistingValue)(valueLabel, valueType, scope, existingValues);
|
|
98
97
|
return {
|
|
99
98
|
type: valueType,
|
|
100
|
-
name:
|
|
101
|
-
didExist: (0, utils_1.findExistingValue)(
|
|
99
|
+
name: valueLabel,
|
|
100
|
+
didExist: (0, utils_1.findExistingValue)(valueLabel, valueType, scope, existingValues),
|
|
102
101
|
value: value.toString() || (existingVariable === null || existingVariable === void 0 ? void 0 : existingVariable.value) || '',
|
|
103
|
-
scope
|
|
102
|
+
scope
|
|
104
103
|
};
|
|
105
104
|
});
|
|
106
105
|
});
|
|
@@ -118,7 +117,8 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
118
117
|
if (existingVariable) {
|
|
119
118
|
let initial_value = existingVariable.value;
|
|
120
119
|
// Get correct initial value for select questions
|
|
121
|
-
if (questionWithVariableLabel.type === 'select' &&
|
|
120
|
+
if (questionWithVariableLabel.type === 'select' &&
|
|
121
|
+
Array.isArray(questionWithVariableLabel.choices)) {
|
|
122
122
|
initial_value = (0, questions_helper_1.getIndexFromChoices)(questionWithVariableLabel.choices, existingVariable.value);
|
|
123
123
|
}
|
|
124
124
|
return [
|
|
@@ -185,8 +185,8 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
185
185
|
auth: githubToken
|
|
186
186
|
});
|
|
187
187
|
(0, logger_1.log)(kleur_1.default.green('\nSuccessfully logged in to Github\n'));
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
const existingEnvironments = yield (0, github_1.getRepositoryEnvironments)(octokit, githubOrganisation, githubRepository);
|
|
189
|
+
const defaultChoices = [
|
|
190
190
|
{ name: 'Development', value: 'development' },
|
|
191
191
|
{ name: 'Quality assurance (no PII data)', value: 'qa' },
|
|
192
192
|
{
|
|
@@ -196,7 +196,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
196
196
|
{
|
|
197
197
|
name: 'Production (hosts PII data, requires frequent backups)',
|
|
198
198
|
value: 'production'
|
|
199
|
-
}
|
|
199
|
+
}
|
|
200
200
|
];
|
|
201
201
|
// Add only environments that are not already present
|
|
202
202
|
const choices = [
|
|
@@ -223,9 +223,15 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
223
223
|
environment_type = yield select({
|
|
224
224
|
message: 'Purpose for the environment?',
|
|
225
225
|
choices: [
|
|
226
|
-
{
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
{
|
|
227
|
+
name: 'Development/Quality assurance/Testing (no PII data)',
|
|
228
|
+
value: 'non-production'
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'Staging/Production (hosts PII data, requires frequent backups)',
|
|
232
|
+
value: 'production'
|
|
233
|
+
}
|
|
234
|
+
]
|
|
229
235
|
});
|
|
230
236
|
}
|
|
231
237
|
const environment_exists = existingEnvironments
|
|
@@ -255,7 +261,9 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
255
261
|
(0, logger_1.log)('\nEnvironment with the name', environment, 'already exists in Github.', '\nFound', existingEnvironmentVariables.length, 'existing variables and', existingEnvironmentSecrets.length, 'secrets');
|
|
256
262
|
}
|
|
257
263
|
if (environment_type === 'production') {
|
|
258
|
-
(0, logger_1.log)('\n', kleur_1.default
|
|
264
|
+
(0, logger_1.log)('\n', kleur_1.default
|
|
265
|
+
.yellow()
|
|
266
|
+
.bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
|
|
259
267
|
yield promptAndStoreAnswer(environment, questions_1.githubOtherQuestions, existingValues);
|
|
260
268
|
}
|
|
261
269
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
|
|
@@ -263,7 +271,8 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
263
271
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
|
|
264
272
|
const infrastructure = yield promptAndStoreAnswer(environment, questions_1.infrastructureQuestions, existingValues);
|
|
265
273
|
const kubeWorkerNodes = infrastructure.kubeWorkerNodes
|
|
266
|
-
? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
|
|
274
|
+
? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
|
|
275
|
+
: [];
|
|
267
276
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
|
|
268
277
|
const users = yield (0, manage_users_1.manageUsers)(`infrastructure/server-setup/inventory/${environment}.yml`);
|
|
269
278
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
|
|
@@ -276,13 +285,13 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
276
285
|
message: 'Choose option to configure Traefik SSL Certificate',
|
|
277
286
|
choices: [
|
|
278
287
|
{ title: "Let's Encrypt certificate", value: 'lets_encrypt' },
|
|
279
|
-
{ title:
|
|
280
|
-
{ title:
|
|
288
|
+
{ title: 'Static SSL certificate', value: 'static_ssl' },
|
|
289
|
+
{ title: 'Custom configuration', value: 'custom' }
|
|
281
290
|
],
|
|
282
291
|
initial: sslCertExists ? 1 : 0
|
|
283
292
|
}
|
|
284
293
|
])).traefikConfOption;
|
|
285
|
-
if (traefikConfOption ===
|
|
294
|
+
if (traefikConfOption === 'static_ssl') {
|
|
286
295
|
ssl_answers = yield (0, editor_questions_1.askQuestionWithEditor)(questions_1.staticSSLCertQuestions, existingEnvironmentSecrets);
|
|
287
296
|
}
|
|
288
297
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Storage'), '\n');
|
|
@@ -306,21 +315,27 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
306
315
|
}
|
|
307
316
|
else {
|
|
308
317
|
if (!enableEncryption && !encryption_key_defined && environment_exists) {
|
|
309
|
-
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
318
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
319
|
+
.bold()
|
|
320
|
+
.grey(`Environment ${environment} is already configured, skipping disk encryption question`));
|
|
310
321
|
}
|
|
311
322
|
const DISK_SPACE = (0, utils_1.findExistingValue)('DISK_SPACE', 'VARIABLE', 'ENVIRONMENT', existingValues);
|
|
312
323
|
if (!DISK_SPACE) {
|
|
313
324
|
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().grey('All available disk space at /data will be used'));
|
|
314
325
|
}
|
|
315
326
|
else {
|
|
316
|
-
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
327
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
328
|
+
.bold()
|
|
329
|
+
.yellow('Variable DISK_SPACE is read-only, allocated space:'), DISK_SPACE === null || DISK_SPACE === void 0 ? void 0 : DISK_SPACE.value);
|
|
317
330
|
}
|
|
318
331
|
}
|
|
319
332
|
// Backup and restore configuration
|
|
320
333
|
let backupHost = ((_a = (0, utils_1.findExistingValue)('BACKUP_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
321
334
|
let backupType = '';
|
|
322
335
|
let restoreEnvironmentName = (_b = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _b === void 0 ? void 0 : _b.value;
|
|
323
|
-
let restoreType = ((_c = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _c === void 0 ? void 0 : _c.value) ||
|
|
336
|
+
let restoreType = ((_c = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _c === void 0 ? void 0 : _c.value) ||
|
|
337
|
+
process.env.RESTORE_ENVIRONMENT_MODE ||
|
|
338
|
+
'dump';
|
|
324
339
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Backup'));
|
|
325
340
|
let configureBackup = backupHost ? true : false;
|
|
326
341
|
// Ask question only if backup and restore are not configured
|
|
@@ -333,15 +348,17 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
333
348
|
let backupHostPrivateKey = '';
|
|
334
349
|
let backupHostPublicKey = '';
|
|
335
350
|
if (configureBackup) {
|
|
336
|
-
const backupAnswers =
|
|
337
|
-
|
|
351
|
+
const backupAnswers = yield promptAndStoreAnswer(environment, questions_1.backupQuestions, existingValues);
|
|
352
|
+
const backupHostPrivateKeyExists = (0, utils_1.findExistingValue)('BACKUP_HOST_PRIVATE_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
338
353
|
backupType = backupAnswers.backupType;
|
|
339
354
|
backupHost = backupAnswers.backupHost || backupHost;
|
|
340
355
|
if (!backupHostPrivateKeyExists) {
|
|
341
356
|
const { publicKey, privateKey } = (0, ssh_keygen_1.generateSSHKeyPair)();
|
|
342
357
|
backupHostPublicKey = publicKey;
|
|
343
358
|
backupHostPrivateKey = privateKey;
|
|
344
|
-
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
359
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
360
|
+
.bold()
|
|
361
|
+
.yellow(`Generated new SSH key pair for backup host: ${backupHost}`));
|
|
345
362
|
}
|
|
346
363
|
}
|
|
347
364
|
else {
|
|
@@ -356,16 +373,17 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
356
373
|
});
|
|
357
374
|
}
|
|
358
375
|
if (configureRestore) {
|
|
359
|
-
const env_list_filtered = existingEnvironments.filter(env => env !== environment);
|
|
376
|
+
const env_list_filtered = existingEnvironments.filter((env) => env !== environment);
|
|
360
377
|
restoreEnvironmentName = yield (0, questions_helper_1.selectWithCustom)({
|
|
361
378
|
message: 'What is the name of your environment to restore?',
|
|
362
|
-
choices: env_list_filtered.map(env => ({
|
|
379
|
+
choices: env_list_filtered.map((env) => ({
|
|
363
380
|
name: env,
|
|
364
381
|
value: env
|
|
365
382
|
})),
|
|
366
383
|
initial: restoreEnvironmentName
|
|
367
384
|
});
|
|
368
|
-
restoreType = yield select({
|
|
385
|
+
restoreType = yield select({
|
|
386
|
+
message: `Select ${kleur_1.default.yellow().bold(restoreEnvironmentName)} environment backup mode`,
|
|
369
387
|
choices: [
|
|
370
388
|
{
|
|
371
389
|
name: 'Full dump (daily full database backup)',
|
|
@@ -375,7 +393,8 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
375
393
|
name: 'Differential (weekly full, daily diff backup)',
|
|
376
394
|
value: 'differential'
|
|
377
395
|
}
|
|
378
|
-
]
|
|
396
|
+
]
|
|
397
|
+
});
|
|
379
398
|
}
|
|
380
399
|
else {
|
|
381
400
|
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Restore is disabled'));
|
|
@@ -410,9 +429,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
410
429
|
/*
|
|
411
430
|
* Variables the user doesn't need to set manually
|
|
412
431
|
*/
|
|
413
|
-
const answerOrExisting = (variable, existingValue,
|
|
414
|
-
// eslint-disable-next-line no-unused-vars
|
|
415
|
-
fn) => fn(variable || (existingValue === null || existingValue === void 0 ? void 0 : existingValue.value)) || '';
|
|
432
|
+
const answerOrExisting = (variable, existingValue, fn) => fn(variable || (existingValue === null || existingValue === void 0 ? void 0 : existingValue.value)) || '';
|
|
416
433
|
function findExistingOrDefine(name, type, scope, newValue) {
|
|
417
434
|
return (0, utils_1.findExistingValue)(name, type, scope, existingValues)
|
|
418
435
|
? null
|
|
@@ -425,7 +442,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
425
442
|
didExist: (0, utils_1.findExistingValue)('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', existingValues),
|
|
426
443
|
value: findExistingOrDefine('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', (0, utils_1.generateLongPassword)()),
|
|
427
444
|
scope: 'REPOSITORY'
|
|
428
|
-
}
|
|
445
|
+
}
|
|
429
446
|
];
|
|
430
447
|
derivedUpdates.push({
|
|
431
448
|
name: 'NOTIFICATION_TRANSPORT',
|
|
@@ -732,24 +749,28 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
|
|
|
732
749
|
two_fa_enabled: environment !== 'production' ? false : true,
|
|
733
750
|
backup_enabled: configureBackup ? true : false,
|
|
734
751
|
restore_enabled: restoreEnvironmentName ? true : false,
|
|
735
|
-
restore_environment_name: restoreEnvironmentName ||
|
|
752
|
+
restore_environment_name: restoreEnvironmentName || '',
|
|
736
753
|
restore_type: restoreType,
|
|
737
754
|
traefik_mode: traefikConfOption,
|
|
738
755
|
backup_type: backupType
|
|
739
756
|
});
|
|
740
|
-
let addon_message = kubeWorkerNodes.length > 0 || configureBackup
|
|
741
|
-
|
|
757
|
+
let addon_message = kubeWorkerNodes.length > 0 || configureBackup
|
|
758
|
+
? '--------------------------------------------------------------------------------------------\n' +
|
|
742
759
|
`\n➡️ ${kleur_1.default.bold().yellow('COPY the SSH public key from the master VM to your clipboard')}\n` +
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
760
|
+
'--------------------------------------------------------------------------------------------\n'
|
|
761
|
+
: '';
|
|
762
|
+
addon_message +=
|
|
763
|
+
kubeWorkerNodes.length > 0
|
|
764
|
+
? `➡️ ${kleur_1.default.bold().yellow('Run following command on Kubernetes worker VM to create provision user and setup SSH key:')}\n` +
|
|
765
|
+
'\n' +
|
|
766
|
+
'curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \\ \n' +
|
|
767
|
+
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"\n`
|
|
768
|
+
: '';
|
|
769
|
+
addon_message += configureBackup
|
|
770
|
+
? `\n➡️ ${kleur_1.default.bold().yellow('Run following command on backup server to create provision user and setup SSH key:')}\n` +
|
|
771
|
+
'curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \\ \n' +
|
|
772
|
+
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"`
|
|
773
|
+
: '';
|
|
753
774
|
(0, logger_1.log)(`
|
|
754
775
|
${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
755
776
|
Follow the steps below to complete the setup of your environment:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-keygen.d.ts","sourceRoot":"","sources":["../../src/environment/ssh-keygen.ts"],"names":[],"mappings":"AAaA,wBAAgB,kBAAkB,IAAI;
|
|
1
|
+
{"version":3,"file":"ssh-keygen.d.ts","sourceRoot":"","sources":["../../src/environment/ssh-keygen.ts"],"names":[],"mappings":"AAaA,wBAAgB,kBAAkB,IAAI;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAMA"}
|
|
@@ -13,6 +13,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.generateSSHKeyPair = generateSSHKeyPair;
|
|
14
14
|
const ssh2_1 = require("ssh2");
|
|
15
15
|
function generateSSHKeyPair() {
|
|
16
|
-
|
|
17
|
-
return {
|
|
16
|
+
const keys = ssh2_1.utils.generateKeyPairSync('ed25519');
|
|
17
|
+
return {
|
|
18
|
+
publicKey: keys.public.toString(),
|
|
19
|
+
privateKey: keys.private.toString()
|
|
20
|
+
};
|
|
18
21
|
}
|
|
@@ -46,6 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
|
+
/* eslint-disable no-console */
|
|
49
50
|
const kleur_1 = __importDefault(require("kleur"));
|
|
50
51
|
const logger_1 = require("./logger");
|
|
51
52
|
const utils_1 = require("./utils");
|
|
@@ -54,10 +55,10 @@ const core_1 = require("@octokit/core");
|
|
|
54
55
|
const ssh_keygen_1 = require("./ssh-keygen");
|
|
55
56
|
const github_1 = require("./github");
|
|
56
57
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
(0, logger_1.log)(kleur_1.default.bold(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
(0, logger_1.log)(kleur_1.default.bold('------------------------------------------------\n' +
|
|
59
|
+
'OpenCRVS Infrastructure migration script: \n' +
|
|
60
|
+
'Migrating Swarm configurations to Kubernetes\n' +
|
|
61
|
+
'------------------------------------------------\n'));
|
|
61
62
|
const environment_type = process.env.ENVIRONMENT_TYPE || 'production';
|
|
62
63
|
const environment = process.env.ENVIRONMENT || '';
|
|
63
64
|
const githubToken = process.env.INFRA_TOKEN || '';
|
|
@@ -79,7 +80,7 @@ const github_1 = require("./github");
|
|
|
79
80
|
(0, logger_1.error)('\n', 'Environment variable INFRA_REPOSITORY is not set. Exiting.');
|
|
80
81
|
process.exit(1);
|
|
81
82
|
}
|
|
82
|
-
if ([
|
|
83
|
+
if (['backup', 'jumpbox'].includes(environment)) {
|
|
83
84
|
(0, logger_1.info)(` > ${environment} environment will not be migrated, see migration notes`);
|
|
84
85
|
process.exit(0);
|
|
85
86
|
}
|
|
@@ -114,12 +115,12 @@ const github_1 = require("./github");
|
|
|
114
115
|
// Hardcode like this blocks us from being generic:
|
|
115
116
|
// https://github.com/opencrvs/opencrvs-core/issues/11171
|
|
116
117
|
two_fa_enabled: environment !== 'production' ? false : true,
|
|
117
|
-
backup_enabled: environment === 'production' ?
|
|
118
|
-
restore_enabled: environment === 'staging' ?
|
|
119
|
-
restore_environment_name: environment === 'staging' ?
|
|
120
|
-
restore_type:
|
|
121
|
-
traefik_mode:
|
|
122
|
-
backup_type:
|
|
118
|
+
backup_enabled: environment === 'production' ? 'true' : 'false',
|
|
119
|
+
restore_enabled: environment === 'staging' ? 'true' : 'false',
|
|
120
|
+
restore_environment_name: environment === 'staging' ? 'production' : '',
|
|
121
|
+
restore_type: 'dump',
|
|
122
|
+
traefik_mode: 'static_ssl',
|
|
123
|
+
backup_type: 'dump'
|
|
123
124
|
});
|
|
124
125
|
if (environment === 'staging') {
|
|
125
126
|
const octokit = new core_1.Octokit({
|
|
@@ -137,18 +138,18 @@ const github_1 = require("./github");
|
|
|
137
138
|
const octokit = new core_1.Octokit({
|
|
138
139
|
auth: githubToken
|
|
139
140
|
});
|
|
140
|
-
console.log(
|
|
141
|
+
console.log('Fetching repository ID for:', githubOrganisation, githubRepository);
|
|
141
142
|
const repositoryId = yield (0, github_1.getRepositoryId)(octokit, githubOrganisation, githubRepository);
|
|
142
|
-
console.log(
|
|
143
|
+
console.log('Repository ID:', repositoryId);
|
|
143
144
|
const { publicKey, privateKey } = (0, ssh_keygen_1.generateSSHKeyPair)();
|
|
144
145
|
const secretsToCreate = {
|
|
145
146
|
BACKUP_HOST_PRIVATE_KEY: privateKey,
|
|
146
147
|
BACKUP_HOST_PUBLIC_KEY: publicKey,
|
|
147
|
-
BACKUP_SERVER_USER:
|
|
148
|
+
BACKUP_SERVER_USER: 'backup'
|
|
148
149
|
};
|
|
149
150
|
const variablesToCreate = {
|
|
150
151
|
BACKUP_HOST: backup_host,
|
|
151
|
-
KUBE_WORKER_NODES: kube_worker_nodes.join(',')
|
|
152
|
+
KUBE_WORKER_NODES: kube_worker_nodes.join(',')
|
|
152
153
|
};
|
|
153
154
|
for (const [secretName, secretValue] of Object.entries(secretsToCreate)) {
|
|
154
155
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAsBA,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,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAsBA,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,QA4BzE"}
|
|
@@ -56,7 +56,7 @@ function extractAndModifyUsers(data) {
|
|
|
56
56
|
}
|
|
57
57
|
const users = data.all.vars.users.map((user) => {
|
|
58
58
|
const { sudoer } = user, rest = __rest(user, ["sudoer"]);
|
|
59
|
-
return Object.assign(Object.assign({}, rest), { role: sudoer ?
|
|
59
|
+
return Object.assign(Object.assign({}, rest), { role: sudoer ? 'admin' : 'operator' });
|
|
60
60
|
});
|
|
61
61
|
return users;
|
|
62
62
|
}
|
|
@@ -103,11 +103,12 @@ function extractWorkerNodes(data) {
|
|
|
103
103
|
* Recursively copy a directory and replace placeholders in text files.
|
|
104
104
|
*/
|
|
105
105
|
function copyChartsValues(env, values) {
|
|
106
|
-
const srcDir = path_1.default.resolve(__dirname,
|
|
107
|
-
const destDir = path_1.default.resolve(process.cwd(),
|
|
106
|
+
const srcDir = path_1.default.resolve(__dirname, 'templates', 'charts-values');
|
|
107
|
+
const destDir = path_1.default.resolve(process.cwd(), 'environments', env);
|
|
108
108
|
fs_1.default.mkdirSync(destDir, { recursive: true });
|
|
109
|
-
values['lets_encrypt'] = values['traefik_mode'] ===
|
|
110
|
-
values['static_ssl'] = values['traefik_mode'] ===
|
|
109
|
+
values['lets_encrypt'] = values['traefik_mode'] === 'lets_encrypt';
|
|
110
|
+
values['static_ssl'] = values['traefik_mode'] === 'static_ssl';
|
|
111
|
+
values['opencrvs_environment'] = env;
|
|
111
112
|
function copyRecursive(src, dest) {
|
|
112
113
|
const stat = fs_1.default.statSync(src);
|
|
113
114
|
if (stat.isDirectory()) {
|
|
@@ -117,16 +118,16 @@ function copyChartsValues(env, values) {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
else {
|
|
120
|
-
const content = fs_1.default.readFileSync(src,
|
|
121
|
+
const content = fs_1.default.readFileSync(src, 'utf8');
|
|
121
122
|
const template = handlebars_1.default.compile(content);
|
|
122
123
|
const updated = template(values);
|
|
123
|
-
const isOverridesFile = dest.endsWith(
|
|
124
|
+
const isOverridesFile = dest.endsWith('override.yaml');
|
|
124
125
|
// Skip overwrite for existing overrides.yaml
|
|
125
126
|
if (isOverridesFile && fs_1.default.existsSync(dest)) {
|
|
126
127
|
(0, logger_1.log)(` ↷ Skipped existing overrides file: ${dest}`);
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
|
-
fs_1.default.writeFileSync(dest, updated,
|
|
130
|
+
fs_1.default.writeFileSync(dest, updated, 'utf8');
|
|
130
131
|
(0, logger_1.log)(` ✓ Created: ${dest}`);
|
|
131
132
|
}
|
|
132
133
|
}
|
|
@@ -147,11 +148,14 @@ function copyChartsValues(env, values) {
|
|
|
147
148
|
*/
|
|
148
149
|
function generateInventory(env, values) {
|
|
149
150
|
// Template and output paths
|
|
150
|
-
const templatePath = path_1.default.join(__dirname,
|
|
151
|
-
const outputPath = path_1.default.join(process.cwd(),
|
|
152
|
-
const templateFile = fs_1.default.readFileSync(templatePath,
|
|
151
|
+
const templatePath = path_1.default.join(__dirname, 'templates', 'inventory', 'inventory.template.yml');
|
|
152
|
+
const outputPath = path_1.default.join(process.cwd(), 'infrastructure', 'server-setup', 'inventory', `${env}.yml`);
|
|
153
|
+
const templateFile = fs_1.default.readFileSync(templatePath, 'utf-8');
|
|
153
154
|
const template = handlebars_1.default.compile(templateFile);
|
|
154
|
-
values['single_node'] =
|
|
155
|
+
values['single_node'] =
|
|
156
|
+
values['kube_worker_nodes'].length > 0 || values['backup_host']
|
|
157
|
+
? 'false'
|
|
158
|
+
: 'true';
|
|
155
159
|
const updated = template(values);
|
|
156
160
|
fs_1.default.mkdirSync(path_1.default.dirname(outputPath), { recursive: true });
|
|
157
161
|
fs_1.default.writeFileSync(outputPath, updated);
|
|
@@ -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":"AAgHA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
|
|
@@ -44,6 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.updateWorkflowEnvironments = updateWorkflowEnvironments;
|
|
46
46
|
const promises_1 = require("fs/promises");
|
|
47
|
+
/* eslint-disable no-console */
|
|
47
48
|
const fs_1 = require("fs");
|
|
48
49
|
const path_1 = require("path");
|
|
49
50
|
const glob = __importStar(require("glob"));
|
|
@@ -52,7 +53,7 @@ const logger_1 = require("./logger");
|
|
|
52
53
|
function extractInfrastructureNames() {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
55
|
const files = glob.sync('infrastructure/server-setup/inventory/*.yml');
|
|
55
|
-
const infraEnvironments = files.map(file => (0, path_1.basename)(file, '.yml'));
|
|
56
|
+
const infraEnvironments = files.map((file) => (0, path_1.basename)(file, '.yml'));
|
|
56
57
|
if (infraEnvironments.length === 0) {
|
|
57
58
|
console.log('⚠️ Warning: No environment directories found in infrastructure/server-setup/inventory/');
|
|
58
59
|
return [];
|
|
@@ -65,7 +66,7 @@ function extractEnvironmentNames() {
|
|
|
65
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
67
|
const entries = yield (0, promises_1.readdir)('environments');
|
|
67
68
|
// Filter only directories
|
|
68
|
-
const environments = entries.filter(entry => {
|
|
69
|
+
const environments = entries.filter((entry) => {
|
|
69
70
|
const fullPath = (0, path_1.join)('environments', entry);
|
|
70
71
|
return (0, fs_1.statSync)(fullPath).isDirectory();
|
|
71
72
|
});
|
|
@@ -89,7 +90,7 @@ function updateOptionsInYaml(content, envList) {
|
|
|
89
90
|
const firstItemMatch = match[2].match(/^([ ]*)-/);
|
|
90
91
|
const itemIndent = firstItemMatch ? firstItemMatch[1] : ' ';
|
|
91
92
|
// Create new options array
|
|
92
|
-
const newOptions = match[1] + envList.map(env => `${itemIndent}- ${env}`).join('\n') + '\n';
|
|
93
|
+
const newOptions = match[1] + envList.map((env) => `${itemIndent}- ${env}`).join('\n') + '\n';
|
|
93
94
|
// Replace the old options array with the new one
|
|
94
95
|
return content.replace(optionsRegex, newOptions);
|
|
95
96
|
}
|
|
@@ -129,7 +130,7 @@ function updateWorkflowEnvironments() {
|
|
|
129
130
|
yield updateWorkflows(infraEnvironments, {
|
|
130
131
|
workflows: [
|
|
131
132
|
'.github/workflows/provision.yml',
|
|
132
|
-
'.github/workflows/reset-2fa.yml'
|
|
133
|
+
'.github/workflows/reset-2fa.yml'
|
|
133
134
|
],
|
|
134
135
|
path: 'on.workflow_dispatch.inputs.environment.options'
|
|
135
136
|
});
|
|
@@ -146,7 +147,7 @@ function updateWorkflowEnvironments() {
|
|
|
146
147
|
'.github/workflows/reindex.yml',
|
|
147
148
|
'.github/workflows/github-to-k8s-sync-env.yml'
|
|
148
149
|
];
|
|
149
|
-
(0, logger_1.log)(
|
|
150
|
+
(0, logger_1.log)('📋 Updating OpenCRVS application workflows:');
|
|
150
151
|
yield updateWorkflows(environments, {
|
|
151
152
|
workflows,
|
|
152
153
|
path: 'on.workflow_dispatch.inputs.environment.options'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function manageEnvironmentUsers(): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=users.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/environment/users.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/environment/users.ts"],"names":[],"mappings":"AA4EA,wBAAsB,sBAAsB,kBAO3C"}
|
|
@@ -45,10 +45,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.manageEnvironmentUsers = manageEnvironmentUsers;
|
|
48
49
|
const fs = __importStar(require("fs"));
|
|
50
|
+
/* eslint-disable no-console */
|
|
49
51
|
const path = __importStar(require("path"));
|
|
50
52
|
const kleur_1 = __importDefault(require("kleur"));
|
|
51
53
|
const manage_users_1 = require("./manage-users");
|
|
54
|
+
const logger_1 = require("./logger");
|
|
52
55
|
function select(options) {
|
|
53
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
57
|
const inquirer = yield import('@inquirer/prompts');
|
|
@@ -66,11 +69,14 @@ function selectInventoryFile() {
|
|
|
66
69
|
return __awaiter(this, arguments, void 0, function* (dirPath = './infrastructure/server-setup/inventory/') {
|
|
67
70
|
// Check if directory exists
|
|
68
71
|
if (!fs.existsSync(dirPath)) {
|
|
69
|
-
|
|
72
|
+
(0, logger_1.warn)(`⚠️ No environment configuration directory found at ${dirPath}`);
|
|
73
|
+
(0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
|
|
74
|
+
return null;
|
|
70
75
|
}
|
|
71
76
|
// Read and filter files
|
|
72
|
-
const files = fs
|
|
73
|
-
.
|
|
77
|
+
const files = fs
|
|
78
|
+
.readdirSync(dirPath)
|
|
79
|
+
.filter((file) => {
|
|
74
80
|
const filePath = path.join(dirPath, file);
|
|
75
81
|
const isFile = fs.statSync(filePath).isFile();
|
|
76
82
|
const ext = path.extname(file).slice(1).toLowerCase();
|
|
@@ -78,10 +84,12 @@ function selectInventoryFile() {
|
|
|
78
84
|
})
|
|
79
85
|
.sort();
|
|
80
86
|
if (files.length === 0) {
|
|
81
|
-
|
|
87
|
+
(0, logger_1.warn)(`⚠️ No environment configuration files found at ${dirPath}`);
|
|
88
|
+
(0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
|
|
89
|
+
return null;
|
|
82
90
|
}
|
|
83
91
|
// Create choices - remove extension from display
|
|
84
|
-
const choices = files.map(file => ({
|
|
92
|
+
const choices = files.map((file) => ({
|
|
85
93
|
name: path.basename(file, path.extname(file)),
|
|
86
94
|
value: path.join(dirPath, file)
|
|
87
95
|
}));
|
|
@@ -92,11 +100,13 @@ function selectInventoryFile() {
|
|
|
92
100
|
return selectedFile;
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
|
-
function
|
|
103
|
+
function manageEnvironmentUsers() {
|
|
96
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
console.log('\n', kleur_1.default.bold().underline(
|
|
105
|
+
console.log('\n', kleur_1.default.bold().underline('Manage users'), '\n');
|
|
98
106
|
const inventory_file = yield selectInventoryFile();
|
|
99
|
-
|
|
107
|
+
if (!inventory_file) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
yield (0, manage_users_1.manageUsers)(inventory_file);
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
|
-
manageUsersStandalone();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/environment/utils.ts"],"names":[],"mappings":"AAeA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/environment/utils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,wBAAgB,oBAAoB,WAMnC;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,aAAa,GAAG,YAAY,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GAMpC,CAAC,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,CAAC,SAAS,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,GACvE,SAAS,CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAoBjE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CAG/C;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAcxD"}
|
|
@@ -80,7 +80,7 @@ function storeSecrets(environment, answers) {
|
|
|
80
80
|
(0, fs_1.writeFileSync)(`.env.${environment}`, allLines.join('\n'));
|
|
81
81
|
}
|
|
82
82
|
function readYamlFile(filePath) {
|
|
83
|
-
const fileContent = fs_1.default.readFileSync(filePath,
|
|
83
|
+
const fileContent = fs_1.default.readFileSync(filePath, 'utf8');
|
|
84
84
|
return yaml.load(fileContent);
|
|
85
85
|
}
|
|
86
86
|
function writeYamlFile(filePath, data) {
|