@oondemand/oon-core-back 0.3.19 → 0.3.20
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/bin/bootstrap-root.js +43 -8
- package/package.json +1 -1
package/bin/bootstrap-root.js
CHANGED
|
@@ -19,6 +19,11 @@ function flag(name, fallback) {
|
|
|
19
19
|
const index = process.argv.indexOf(name);
|
|
20
20
|
return index < 0 ? fallback : process.argv[index + 1];
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
function setting(flagName, envName, fallback) {
|
|
24
|
+
return flag(flagName, process.env[envName] || fallback);
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
function required(value, name) {
|
|
23
28
|
if (!value) throw new Error(`${name} obrigatório.`);
|
|
24
29
|
return value;
|
|
@@ -28,16 +33,43 @@ async function main() {
|
|
|
28
33
|
const appCode = dnsLabel(flag("--app-code", "central-ativacao"));
|
|
29
34
|
const imageDigest = required(flag("--image-digest"), "--image-digest");
|
|
30
35
|
const infra = validateInfraFromCluster().config;
|
|
36
|
+
const protocol = infra.DEFAULT_PROTOCOL || "https";
|
|
31
37
|
const hostname = flag("--hostname", `${appCode}.${infra.DNS}`);
|
|
32
|
-
const publicUrl = `${
|
|
38
|
+
const publicUrl = `${protocol}://${hostname}`;
|
|
33
39
|
const apiUrl = `${publicUrl}/api`;
|
|
34
40
|
const namespace = `${infra.RUNTIME_NAMESPACE_PREFIX || "oon"}-${appCode}-dev`
|
|
35
41
|
.slice(0, 63)
|
|
36
42
|
.replace(/-+$/, "");
|
|
43
|
+
const registryOwner = setting(
|
|
44
|
+
"--registry-owner",
|
|
45
|
+
"PLATFORM_REGISTRY_OWNER",
|
|
46
|
+
"oondemand",
|
|
47
|
+
);
|
|
37
48
|
const imageRepository = flag(
|
|
38
49
|
"--image-repository",
|
|
39
|
-
`${infra.REGISTRY_HOST || "ghcr.io"}
|
|
50
|
+
`${infra.REGISTRY_HOST || "ghcr.io"}/${registryOwner}/${appCode}`,
|
|
51
|
+
);
|
|
52
|
+
const deliveryRepository = setting(
|
|
53
|
+
"--delivery-repository",
|
|
54
|
+
"PLATFORM_DELIVERY_REPOSITORY",
|
|
55
|
+
"oondemand/central-ativacao",
|
|
40
56
|
);
|
|
57
|
+
const deliveryWorkflow = setting(
|
|
58
|
+
"--delivery-workflow",
|
|
59
|
+
"PLATFORM_DELIVERY_WORKFLOW",
|
|
60
|
+
"publish-central-dev.yml",
|
|
61
|
+
);
|
|
62
|
+
const deliveryRef = setting(
|
|
63
|
+
"--delivery-ref",
|
|
64
|
+
"PLATFORM_DELIVERY_REF",
|
|
65
|
+
"main",
|
|
66
|
+
);
|
|
67
|
+
const administrativeEmail = setting(
|
|
68
|
+
"--administrative-email",
|
|
69
|
+
"PLATFORM_ADMINISTRATIVE_EMAIL",
|
|
70
|
+
"plataforma@oondemand.com.br",
|
|
71
|
+
);
|
|
72
|
+
|
|
41
73
|
const context = {
|
|
42
74
|
releaseId: `bootstrap-${appCode}`,
|
|
43
75
|
appCode,
|
|
@@ -51,16 +83,16 @@ async function main() {
|
|
|
51
83
|
const extraSecrets = {
|
|
52
84
|
GITHUB_OIDC_AUDIENCE: apiUrl,
|
|
53
85
|
PLATFORM_DNS: infra.DNS,
|
|
54
|
-
PLATFORM_DEFAULT_PROTOCOL:
|
|
86
|
+
PLATFORM_DEFAULT_PROTOCOL: protocol,
|
|
55
87
|
PLATFORM_REGISTRY_HOST: infra.REGISTRY_HOST || "ghcr.io",
|
|
56
|
-
PLATFORM_REGISTRY_OWNER:
|
|
88
|
+
PLATFORM_REGISTRY_OWNER: registryOwner,
|
|
57
89
|
PLATFORM_RUNTIME_NAMESPACE_PREFIX:
|
|
58
90
|
infra.RUNTIME_NAMESPACE_PREFIX || "oon",
|
|
59
|
-
PLATFORM_DELIVERY_REPOSITORY:
|
|
60
|
-
PLATFORM_DELIVERY_WORKFLOW:
|
|
61
|
-
PLATFORM_DELIVERY_REF:
|
|
91
|
+
PLATFORM_DELIVERY_REPOSITORY: deliveryRepository,
|
|
92
|
+
PLATFORM_DELIVERY_WORKFLOW: deliveryWorkflow,
|
|
93
|
+
PLATFORM_DELIVERY_REF: deliveryRef,
|
|
62
94
|
PLATFORM_API_URL: apiUrl,
|
|
63
|
-
PLATFORM_ADMINISTRATIVE_EMAIL:
|
|
95
|
+
PLATFORM_ADMINISTRATIVE_EMAIL: administrativeEmail,
|
|
64
96
|
};
|
|
65
97
|
|
|
66
98
|
const provisioned = await provisionRuntime({ context, extraSecrets });
|
|
@@ -90,6 +122,9 @@ async function main() {
|
|
|
90
122
|
apiUrl,
|
|
91
123
|
activationUrl: `${publicUrl}/ativacao`,
|
|
92
124
|
imageDigest,
|
|
125
|
+
deliveryRepository,
|
|
126
|
+
deliveryWorkflow,
|
|
127
|
+
deliveryRef,
|
|
93
128
|
},
|
|
94
129
|
null,
|
|
95
130
|
2,
|