feat: Add poblacion_apta service to docker-compose, enhance API gateway for new service integration, and update README with service details. Introduce new database tables for poblacion_apta_jobs and poblacion_apta_rows, and implement functionality for handling cop/mod calculations in the cleaning service.
This commit is contained in:
@@ -103,14 +103,32 @@ async function sha256File(filePath) {
|
||||
}
|
||||
|
||||
async function upload(client, key, body, contentType) {
|
||||
await client.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
Body: body,
|
||||
ContentType: contentType,
|
||||
}),
|
||||
);
|
||||
const payload = Buffer.isBuffer(body)
|
||||
? body
|
||||
: typeof body === "string"
|
||||
? Buffer.from(body, "utf8")
|
||||
: body;
|
||||
|
||||
const params = {
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
Body: payload,
|
||||
ContentType: contentType,
|
||||
};
|
||||
|
||||
// MinIO exige Content-Length; con Body string/stream el SDK a veces no lo envía.
|
||||
if (Buffer.isBuffer(payload)) {
|
||||
params.ContentLength = payload.byteLength;
|
||||
} else if (typeof payload === "object" && payload && "path" in payload) {
|
||||
// ReadStream desde createReadStream(path)
|
||||
try {
|
||||
params.ContentLength = statSync(payload.path).size;
|
||||
} catch {
|
||||
/* ignore — el stream del .exe suele ir bien */
|
||||
}
|
||||
}
|
||||
|
||||
await client.send(new PutObjectCommand(params));
|
||||
console.log(` ↑ s3://${bucket}/${key}`);
|
||||
}
|
||||
|
||||
@@ -201,7 +219,13 @@ async function main() {
|
||||
|
||||
console.log(`Publicando v${version} → ${endpoint}/${bucket}/${prefix}/`);
|
||||
await upload(client, objectKeyExe, createReadStream(setupPath), "application/octet-stream");
|
||||
await upload(client, objectKeyData, `${releaseDateDisplay}\n`, "text/plain; charset=utf-8");
|
||||
// Re-upload metadata even if exe already exists (reintento tras fallo parcial).
|
||||
await upload(
|
||||
client,
|
||||
objectKeyData,
|
||||
Buffer.from(`${releaseDateDisplay}\n`, "utf8"),
|
||||
"text/plain; charset=utf-8",
|
||||
);
|
||||
await upload(
|
||||
client,
|
||||
objectKeyLatest,
|
||||
|
||||
Reference in New Issue
Block a user